From 30fdbbdae721445ce465e9dd1cdfea8f3d01ec38 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 15 Sep 2016 10:03:41 +0200 Subject: [PATCH] Adding support for failover situation --- cluster_cron.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cluster_cron.pl b/cluster_cron.pl index f17d7ea..3c7d132 100755 --- a/cluster_cron.pl +++ b/cluster_cron.pl @@ -213,6 +213,10 @@ sub run { # If we have an active shared cronfile, we should also have an old shared # See if I am the one if (is_active(get_nodes) ){ + if(compare($cronfile, $passivesharedcronfile)) == 0) { + print "There has been a failover, switching to active cronfile\n"; + copy($activesharedcronfile, $cronfile); + } my $tempfile = tmpnam(); my $compare = cron_compare($cronfile, $activesharedcronfile, $oldactivesharedcronfile ); # The other node has changed the file