looking for inotifywait and similar help

Enrico Scholz enrico.scholz at informatik.tu-chemnitz.de
Wed Dec 3 08:26:25 UTC 2008


"Dan Nicholson" <dbn.lists at gmail.com> writes:

>> However the issue I have is that I don't know how to have inotifywait
>> do something when /etc/crontab or /etc/fcrontab is created since if I
>> give a non-existing file as argument it will error out.
>
> I think if you want to catch file creation, you have to watch /etc,
> wait for create events and filter for the crontab files. So, I think
> it would have to be something like:
>
> out=`inotifywait -e create /etc`; do
> if [ $? = 0 ]; then
> ...

Beside the syntax error, there is a race when file was created shortly
before inotifywait. You have to check whether the file exists *after*
inotify_add_watch(2) like in

             https://www.cvg.de/people/ensc/wait-for-file.c


I filed a request a year ago to include similar functionality into
inotifytools but this does not seem to implemented yet

  http://sourceforge.net/mailarchive/message.php?msg_name=lylkdk440g.fsf%40ensc-pc.intern.sigma-chemnitz.de



Enrico




More information about the devel mailing list