Inotifywait won't run

81 views Asked by At

inotifwait won't run command

"Setting up watches. Watches established" is output, script just exit

 #!/bin/bash

while $(inotifywait -e  modify,close_write /home/centos/test.txt);
do
  touch /home/centos/log.txt
done

but when i modify test.txt log.txt is not created

Tried this version:

#!/bin/bash

inotifywait -e modify,close_write /home/centos/test.txt |
while read output; do
  touch /home/centos/log.txt;
done

tried this also:

inotifywait -e modify,close_write /home/centos/test.txt |
while read -r filename event; do
  echo "test"        # or "./$filename"
done
1

There are 1 answers

0
AudioBubble On

Solved it by adding -m /folder