In my script
/usr/local/bin/backup, that I call every hour from
/etc/crontab, I use rsync to copy data to an off-site server.
That all worked fine, even in cases where we had somewhat more new data than can be pushed out in an hour.
Last week someone copied an 11GB file on the data partition and when I found out the next day there were 14 rsync programs running in parallel, each of then getting no bandwidth and each probably working on the same huge file. I killed them all (before realising I should have kept the first one running), stopped the cron job and ran the backup script by hand.
I can write out a file in the script before starting rsync and check in the script if that file is already there to prevent backup from running in parallel. Is there an easier way of doing this?
5 * * * * root /usr/local/bin/backup