[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Linux-cluster] Re: Centralized Cron



nick burnett wrote:
> saju john write:
> > Dear All,
> > 
> > Is there any way to make a centalized cron while using
> > Redhat HA cluster with Sahred storage. I mean to put the
> > crontab entry for a particular user on shared storage, so
> > that when the cluster shifts, on the other node cron should
> > read from the cron file in shared storage.
> > 
> > This setup has the advantage that we don't need to manullay
> > update the cron entry in both nodes.
> > 
> > I tried two ways , but not success
> > 
> > a) Make a soft link from /var/spool/cron/<user> to
> > /path/to/shared/storage/<user>. This will work as long as I
> > didn't make any changes to existing crontab. Once I make
> > changes to crontab, the link is removed and file is created
> > at /var/spool/cron/<user>
> > 
> > b) Soft link the cron directory in /var/spool to
> > /path/to/shared/storage/cron. This is working till the
> > cluster shift. The cron is getting dead when the cluster
> > shifts as it lose the /var/spool/cron link's destination
> > driectory which will be mapped to the other node
> > 
> > Thanks in advance
> > 
> > Saju John
> > 
> You need to add in a heartbeat trigger. The cron daemon runs
> on one server only. When that server goes offline, then
> start the cron daemon on the backup server. This is a
> terrible solution though.

i just noticed the above on the net with no solution proposed.
in case you still one:

the elegant solution to this is to write a little shell
script that takes another command as its arguments, detects
whether or not it is running on the primary server, and if
it is, runs the given command. otherwise it does nothing.
then, run cron on both servers with completely identical
crontabs with the name of this script inserted before every
cronjob.

i've done this on a solaris cluster (the script is called
"clustered" naturally enough) and it works a treat. you
can even install the crontabs together from another host
to keep them always in sync.

i don't know what command you'd need on a linux cluster
to determine whether or not you are running on the primary
host but there must be something that does it.

cheers,
raf


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]