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?