diff options
| author | Paul Buetow <paul@buetow.org> | 2024-03-21 20:07:50 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-03-21 20:07:50 +0200 |
| commit | 95c2365df04de6b8bfa964f672ab77aeb3ec792e (patch) | |
| tree | a298a92fa6ff56c1f4baa9e91bb7e6d7e37706ad /frontends | |
| parent | 4eb3653ae07f2afc84d7bc4534f4ed2dbf8f2700 (diff) | |
configure minutely cron job for auto-dns failover
Diffstat (limited to 'frontends')
| -rw-r--r-- | frontends/Rexfile | 8 | ||||
| -rw-r--r-- | frontends/scripts/dns-failover.ksh | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/frontends/Rexfile b/frontends/Rexfile index 08e730b..652d8c4 100644 --- a/frontends/Rexfile +++ b/frontends/Rexfile @@ -356,6 +356,14 @@ task 'nsd_failover', group => 'frontends', mode => '500'; append_if_no_such_line '/etc/daily.local', '/usr/local/bin/dns-failover.ksh'; + + file '/tmp/root.cron', + ensure => 'file', + content => "*\t*\t*\t*\t*\t-ns /usr/local/bin/dns-failover.ksh", + mode => '600'; + + run '{ crontab -l -u root ; cat /tmp/root.cron; } | uniq | crontab -u root -'; + run 'rm /tmp/root.cron'; }; desc 'Setup DTail'; diff --git a/frontends/scripts/dns-failover.ksh b/frontends/scripts/dns-failover.ksh index 9cc09b8..6fced80 100644 --- a/frontends/scripts/dns-failover.ksh +++ b/frontends/scripts/dns-failover.ksh @@ -103,7 +103,7 @@ failover_zone () { echo "Reloading nsd" nsd-control reload zone_is_ok $zone - return 1 + exit 1 fi for cleanup in invalid bak; do @@ -111,7 +111,9 @@ failover_zone () { rm $zone_file.$cleanup fi done + echo "Failover of zone $zone to $MASTER completed" + return 0 } main () { |
