I wrote a script that checks the status of the cluster and if it is 'active' runs the command specified such as:
/usr/bin/active-check.sh /usr/bin/my-cron-command.sh with some args
Here is the guts of the scripts (used with heartbeat 1.x systems)
#!/bin/bash
STATE=`/usr/bin/cl_status rscstatus`
if [ "x"${STATE} == "xall" ]; then
exec $1 $2 $3 $4 $5 $6 $7 $8 $9
fi
On Tue, Mar 03, 2009 at 09:21:59PM +0200, Thanos Chatziathanassiou wrote:
> O/H Yan Seiner έγραψε:
>> I am trying to figure out how to set up a failover system that runs apps
>> from crontab.
>>
>> In my current setup, the server starts a cron job every 2 hours that
>> reaches out to my clients and pulls data. This must be a server-pull;
>> there is no way to set it up as a client-push. The data that's pulled
>> will be replicated using rsync, coda, etc to the backup server. (I have
>> not gotten that far yet.)
>>
>> I'd like to set this up as a failover system. Apache sounds easy, but how
>> do I failover a cron job?
>>
>> Also, is it possible to have the two servers in different geographic
>> locations? Ie. to do the failover to another server, in another country?
>>
>> --Yan
>>
>>
> Facing a similar situation, I created a separate crontab.in for the user
> i wanted (mailman) and this simple script:
> ---snip---
> #! /bin/sh
> #
> # Get functions
> . /etc/init.d/functions
>
> # See how we were called.
> case "$1" in
> start)
> echo -n "Setting up mailman crontab..."
> /usr/bin/crontab -u mailman /opt/shared/var/mailman/cron/crontab.in
> echo
> ;;
> stop)
> echo -n "Removing mailman crontab"
> /usr/bin/crontab -u mailman -r
> echo
> ;;
> status)
> [ `/usr/bin/crontab -u mailman -l 2>&1 | grep -c qrunner` -gt 0 ] &&
> echo -n "mailman running" || echo -n "mailman stopped"
> #removed (heartbeat doesn't like it)
> #/usr/bin/crontab -u mailman -l
> echo
> ;;
> *)
> echo "Usage $0 (start|stop|status)"
> ;;
> esac
>
> exit 0
> ---snip---
>
> Hope it helps.
>
> Thanos Chatziathanassiou
>
> _______________________________________________
> Linux-HA mailing list
> [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha
> See also: http://linux-ha.org/ReportingProblems
--
James R. Leu
[email protected]
pgpkfmYvOyWK7.pgp
Description: PGP signature
_______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
