inotifywait – a very handy utility

A simple way to watch a directory and take action. Could have issues with race conditions so to be used only in simpler set-ups but a great lightweight alternative to running rsync on a cron schedule.

Documentation at http://linux.die.net/man/1/inotifywait

My own script on Tiny Core Linux (/home/scripts/pivotx-monitor.sh), which runs the backup utility upon posting of an entry in my blog.

/usr/local/bin/inotifywait -r -m -e close_write /home/apache2/pivotx/pivotx/db/s

sudo filetool.sh -b

done

Called from bootlocal.sh as

su tc “-c /home/scripts/pivotx-monitor.sh>/home/pivtox.log”

Advertisements