[GRLUG] using flock

Eric Beversluis ebever at researchintegration.org
Tue Dec 24 09:17:09 EST 2013


I've got a backup program on a server that includes a mysqldump once a
day which overwrites the existing sysmyqldump.sql. The script also does
rsync (of zarafa-backup, the mysqldump, and /var/lib/zarafa (the zarafa
attachments file) to an external hard drive. Once a month is also copies
the sysmysqldump.sql that's on the external HDD to a file with that
day's date attached.

The cron is set to run every hour. Right now, mysqldump is finishing at
40 min past the hour (00:40), so I think that when it also tries to make
the copy on the 1st of the month it will run over into the next hour.

As I understand it, the thing to do to prevent the script starting over
before the old one finishes is to use 'flock.'

My question is this: How does cron respond if flock prevents the script
from starting at 01:00? Does it start it when the flock is freed or just
skip that cycle or what?

Thanks.



More information about the grlug mailing list