jhmiller
jhmiller

Reputation: 99

Screen keeps terminating

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

Upvotes: 0

Views: 342

Answers (1)

F. Hauri  - Give Up GitHub
F. Hauri - Give Up GitHub

Reputation: 70722

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

Upvotes: 2

Related Questions