2

The situation is:

I have a shared directories from many other machines where other users work on.

I need to be notified whenever a user create, modify or delete a directory or file from his local directory which I share using smb...

It looks like the folder actions in the MAC systems..

Is there a software that do that?!

If there is no such application, any help in writing a script for that is appreciated..

Thanks in advanced...

Maythux
  • 84,289
  • If no one gives an answer in a couple of days for a program/script. Then reply with a comment here (so I get a notification) and I can look into writing a quick script. I am a little busy today. – Julian Stirling Dec 30 '13 at 12:31
  • @JulianStirling Ok friend sure i'll do. Thanks anyway – Maythux Dec 30 '13 at 13:09
  • @JulianStirling It seems no body can help.. When you have some time please help – Maythux Jan 01 '14 at 08:45
  • Right, just to clarify you want a script to make an on screen notification every time someone changes a file in a folder? What do you want it to do if your pc is off? Bring up a list? Do you need to dismiss items when they are somehow tracked? – Julian Stirling Jan 02 '14 at 17:36
  • @JulianStirling I want a script to make screen notification every time someone changes a file/folder in a Shared folder. – Maythux Jan 03 '14 at 07:39

2 Answers2

5

OK, first install inotify:

sudo apt-get install inotify-tools

Then make a new script on your computer named whatever you want (filename.sh) and paste in:

#! /bin/bash

folder=~/random/test

inotifywait -m -q -e delete -e create -e move -e modify -r --format '%:e %w%f' $folder | while read file
  do
    zenity  --title="Modifaction" --text "$file" --info&
  done

Modify the folder to the one you want, save, and then exit.

Make the file executable:

chmod +x filename.sh

And then you should be ready to rock.

1

You may use iwatch to watch a specific folder (directory) which itself relies on inotify (inode notify), a subsystem in the Linux kernel which extends filesystems to notice changes within them, and report those changes to applications.

Download it from http://ftp.debian.org/debian/pool/main/i/iwatch/ then once installed, open a terminal window and run

iwatch /folder

where /folder is changed to the directory you want to watch.

K7AAY
  • 17,202
  • can you help me in incron – nux Dec 31 '13 at 20:24
  • ty my friend , happy new year , just one other question how it will notify me ? – nux Dec 31 '13 at 21:29
  • A message will appear in that window. However, the iwatch web page linked above shows other options if you want to consider them. And, OBTW, if an answer to your question is good, please click on the checkmark-on-circle icon at left to show it was good. You can change that later if a better answer comes up which meets your needs more directly. This also adds karma points to your rep. – K7AAY Dec 31 '13 at 21:32