Is it possible to use the watch command to see if a file exists, and if it does then stop a service? Or possibly, as a workaround, check the content of the file and then stop a service?
I was looking at the watch command to do this:
watch -d -g -t ls -l /home/username/twitter-failed.log && service cups stop
The problem for me is that I don't understand this command completely. I think it check the output "ls" here, but what does it check "ls" for? I need the command to check the "twitter-failed.log" for any kind of content. The file is blank when there are no errors, but generates a whole bunch of text when there is an error. So the watch command only needs to check the file for any kind of output, then stop the service.