2

I want to start this inotifywait script on startup of the machine, in order to monitor the folders from the moment of booting:

#!/bin/bash
while inotifywait -r -e  modify,attrib,close_write,move,create,delete /var/www/htdocs   /administrator /var/www/htdocs/components; do
    sh /home/ec2-user/s3backup.sh
done

To do this, I added the script location to the /etc/rc.local file. When I reboot the machine, I can see that there's a inotifywait process running but nothing happens, when a file is changed. When I start the script (or the rc.local file) manually, everything works fine. What am I doing wrong?

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Biffy
  • 121
  • 2
  • When you run the script manually, are you running it as yourself or as root? Everything in rc.local runs as root. Also, can you collect some debugging info? inotifywait outputs info on stdout and stderr. You should capture those to files when the system boots and see if there is anything interesting there. – Phil Hollenback Jan 05 '15 at 04:54

0 Answers0