I need to monitor if, for example, file /tmp/somefile123 was created after some events. I tried to use inotifywait but here is a problem:
# inotifywait -q -e create /tmp/somefile?* Couldn't watch /tmp/somefile?*: No such file or directory
because there is exactly no such file, I want to know if it will be there!
How can I resolve this issue?
UPD: Maybe if I explain what I want to reach it will be more clear.
I need to write shell script (sh) with minimal CPU consumption, something like this:
if [ $(inotifywait -e create $SPECIFIC_FILE) ]; then blah-blah-blah some actions fi # And then similarly monitor if this file was deleted and then do another actions
I expect that script will stop execution on inotifywait -e create $SPECIFIC_FILE till this $SPECIFIC_FILE will not created and it would be better then
while [ ! -f $SPECIFIC_FILE ]; do blah-blah-blah some actions sleep 1 done