<div dir="ltr">Pretty easy to implement in bash or sh..  The only problem is, if you Crtl-C out of it, you'll have to manually remove the lock file.<div><br></div><div>if [ -f /var/run/script.lock ]; then</div><div>     print "Already running..  Exiting"</div>

<div>     exit 1</div><div>fi</div><div><br></div><div>date > /var/run/script.lock</div><div><br></div><div># put your script here</div><div><br></div><div># at the end</div><div>rm -f /var/run/script.lock</div></div>
<div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Dec 24, 2013 at 9:17 AM, Eric Beversluis <span dir="ltr"><<a href="mailto:ebever@researchintegration.org" target="_blank">ebever@researchintegration.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've got a backup program on a server that includes a mysqldump once a<br>
day which overwrites the existing sysmyqldump.sql. The script also does<br>
rsync (of zarafa-backup, the mysqldump, and /var/lib/zarafa (the zarafa<br>
attachments file) to an external hard drive. Once a month is also copies<br>
the sysmysqldump.sql that's on the external HDD to a file with that<br>
day's date attached.<br>
<br>
The cron is set to run every hour. Right now, mysqldump is finishing at<br>
40 min past the hour (00:40), so I think that when it also tries to make<br>
the copy on the 1st of the month it will run over into the next hour.<br>
<br>
As I understand it, the thing to do to prevent the script starting over<br>
before the old one finishes is to use 'flock.'<br>
<br>
My question is this: How does cron respond if flock prevents the script<br>
from starting at 01:00? Does it start it when the flock is freed or just<br>
skip that cycle or what?<br>
<br>
Thanks.<br>
<br>
_______________________________________________<br>
grlug mailing list<br>
<a href="mailto:grlug@grlug.org">grlug@grlug.org</a><br>
<a href="http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug" target="_blank">http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug</a><br>
</blockquote></div><br></div>