diff options
author | Luke Bratch <luke@bratch.co.uk> | 2017-09-20 19:50:55 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2017-09-20 19:50:55 +0100 |
commit | 156bdf66d4f433d8289f03e1a0ba3e6d0cd04e06 (patch) | |
tree | 4587144ee4193efe53189609d4032de7b105f0c6 /dns.php | |
parent | f56418929029b40b758e9ae8051afc9f4782cb60 (diff) |
Handle a failure when writing the zone file
Diffstat (limited to 'dns.php')
-rw-r--r-- | dns.php | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -119,7 +119,14 @@ function writezone($domain, $zonetext, $password = null) { } // Reload the zone if we got this far - sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX); + $zonewrite = sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX . " && echo $? || echo $?"); + + // If the return code was non-zero then fail + if ($zonewrite[sizeof($zonewrite) - 1] != "0") { + echo "<p>error: something went wrong when writing the zone file, please ask someone for help</p>"; + die(); + } + sshrun("rndc reload $domain"); } |