diff options
author | Ermal <eri@pfsense.org> | 2010-09-22 15:32:23 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-09-22 15:32:23 +0000 |
commit | 838feb14e175b8132e9d9c0c5ca8adfc9d187837 (patch) | |
tree | 6d1ec95a77298d08cd51df8349ea2b06ef33c7fb /etc | |
parent | fbd5fc52a755d46ef8de775fb6474af39fd14960 (diff) | |
download | pfsense-838feb14e175b8132e9d9c0c5ca8adfc9d187837.zip pfsense-838feb14e175b8132e9d9c0c5ca8adfc9d187837.tar.gz |
If we fail to send an event to check_reload_status consider its not running and try restarting it.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/util.inc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 272512e..588bb00 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -140,13 +140,19 @@ function unlock($cfglckkey = 0) { function send_event($cmd) { global $g; - $fd = fsockopen($g['event_address']); - if ($fd) { - fwrite($fd, $cmd); - $resp = fread($fd, 4096); - if ($resp != "OK\n") - log_error("send_event: sent {$cmd} got {$resp}"); - fclose($fd); + $try = 0; + while ($try < 3) { + $fd = @fsockopen($g['event_address']); + if ($fd) { + fwrite($fd, $cmd); + $resp = fread($fd, 4096); + if ($resp != "OK\n") + log_error("send_event: sent {$cmd} got {$resp}"); + fclose($fd); + $try = 3; + } else + mwexec_bg("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status"); + $try++; } } |