On Wed, Dec 03, 2008 at 09:26:25AM +0100, Enrico Scholz wrote:
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 don't really understand when the race condition could be, but in my case there is a sleep 30 anyway before launching a command that checks itself if the file exists, so I think this doesn't apply in my case.
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%40ens...
In both cases /etc is watched. That is something I would have liked to avoid, because it will cause my script to wake up a lot, compared with only looking at /etc/cron.d, /etc/crontab and /etc/fcrontab.
It looks like signalling that a file came into existence without watching the directory the file is in is not possible with inotify currently.
-- Pat