0

I am trying to run a script in a screen that uses inotifywait to check for new files being created and then runs a script when an event that matches some parameters occurs. For some reason screen keeps terminating even though the script being run is looped.

I start the screen with screen -d -m -S scriptname //path to .sh and the looped part of the script look like this

#start folder monitoring
while fileevent=$(inotifywait -rq -e create $path_to_monitor); do CheckFileEvent; done
jhmiller
  • 99
  • 1
  • 8

1 Answers1

2

The loop of your run depend from the result of your assignment, try this:

while :;do
    fileevent=$(inotifywait -rq -e create $path_to_monitor)
    CheckFileEvent
  done
F. Hauri - Give Up GitHub
  • 64,122
  • 17
  • 116
  • 137