[CentOS-mirror] Final steps of setting up a mirror.

Fri Feb 15 04:47:51 UTC 2008
David Richardson <david.richardson at utah.edu>

On Thu, 14 Feb 2008, gw at geeklan.com wrote:

> Howdy folks.
>
> I'm on the final stages of this mirror setup.
>
> I'm unsure of how to handle locking with cron - saw an app called lockcron, 
> but I have a feelingg this isn't the way and the setup page recommends asking 
> the list so..
>
> How do I stop cron from overrunning? :)

For my mirror, I have cron run a script, which looks like this:

>#!/bin/bash
>
>### Lock file
>if [ -f /tmp/update-mirrors.lock ]
>   then echo "Lock file exists" && exit 1
>else
>   date >> /tmp/update-mirrors.lock
>fi
>
>
>### Do a bunch of stuff
>
>
>### Remove lock file
>/bin/rm -rf /tmp/update-mirrors.lock


And then to /etc/rc.local I add
>/bin/rm -rf /tmp/update-mirrors.lock >/dev/null 2>&1
(to make sure that if the box reboots during a run, the lock file will be 
removed).

DR

-- 
David Richardson <david.richardson at utah.edu>
"I can't eat muffins in an agitated manner. The butter would probably
get on my cuffs. One must eat muffins quite calmly, it is the only way
to eat them." -- Algernon, The Importance of Being Earnest