First, run command, then wait for inotify signals. Use a do-while loop instead of a while loop.