How can I terminate a process if a second inotify event occurs?
2
1
inotifywait -q -m -e close_write,create --recursive ../orgmode-parse-print | while read -r filename event; do echo $filename; echo $event sleep infinity; done The problem with the above is it 'sleeps' forever and never terminates. How can I terminate or restart the process (essentially the contents of the while loop (including the sleep )) if another event occurs? In other words, do the command, but terminate it (interrupt it I suppose) and start again if a file has been modified. I'm using sleep as an example here - the actual process being run is a long running process.
inotify
share | improve this question
edited Jul 15...