LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: Shared cron jobs

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Shared cron jobs
From: "Ben Hollingsworth" <ben.hollingsworth@xxxxxxxxxxxx>
Date: Sat, 13 May 2006 04:57:30 -0500
Neil wrote:
you have a virtual ip which only one of the hosts has at a time. I'd use that

have the cron job on both but making it check if its host has that ip address 
and exit if it doesn't.

That's essentially the same mechanism I use to handle failover on a pair of AIX boxes at work. In that case, all our application data is on a shared SAN that both servers can mount, but only one at a time (by the live system). In my cron jobs, I do something like:

00 01 * * * if [ -f /file/on/shared/filesystem ]; then /command/to/run; fi

so that /command/to/run will only get executed if /file/on/shared/filesystem exists. It works quite well. You could replace that conditional with something that checks for the existence of your VIP interface, or anything else that is guaranteed to only exist on the live box. The command being run doesn't have to know anything about what's happening, since the failover check is being done within cron.

Dan Brown wrote:
My pair of LVS servers share the same database.  I have a couple of sites
which import data daily from other sites, or via uploaded files.  I do not
want the servers to both be running the same job at the same time obviously
so I'd like to swap out crontab files when the backup director takes over.


<Prev in Thread] Current Thread [Next in Thread>