Initialize source and destination directories.
srcdir=/user/user1/src
tagtdir=/user/user1/dest
I would like to get notified when a file is copied over into the srcdir and -m
for continuous monitoring.
inotifywait -m -r -e close "$srcdir" |
while read filename eventlist eventfile
Invoke my python script.
do
mv "$srcdir/$eventfile" "$tgtdir/$eventfile" && ./myscript.py "$eventfile"
done
Unfortunately, my script that quite some time and if there are other files being copied over while myscript.py
is being executed, I miss those events. Is it possible to queue up the events and process them later?
Another option is I will run myscript.py
in background and that might solve this issue.