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?

1
  • 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. Jan 5 '15 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.