diff options
Diffstat (limited to 'etc/inc/vslb.inc')
-rw-r--r-- | etc/inc/vslb.inc | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index ef35c2b..dcf30cf 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -201,6 +201,7 @@ function relayd_configure() { /* reindex pools by name as we loop through the pools array */ $pools = array(); + $conf .= "log updates \n"; /* Virtual server pools */ if(is_array($pool_a)) { for ($i = 0; isset($pool_a[$i]); $i++) { @@ -230,7 +231,7 @@ function relayd_configure() { if(is_array($vs_a)) { for ($i = 0; isset($vs_a[$i]); $i++) { switch($vs_a[$i]['mode']) { - case 'redirect': { + case 'redirect_mode': { $conf .= "redirect \"{$vs_a[$i]['name']}\" {\n"; $conf .= " listen on {$vs_a[$i]['ipaddr']} port {$vs_a[$i]['port']}\n"; $conf .= " forward to <{$vs_a[$i]['pool']}> port {$pools[$vs_a[$i]['pool']]['port']} {$check_a[$pools[$vs_a[$i]['pool']]['monitor']]} timeout 1000\n"; @@ -259,17 +260,27 @@ function relayd_configure() { fwrite($fd, $conf); fclose($fd); - if (is_process_running('relayd: parent')) { - /* - * XXX: Something breaks our control connection with relayd and makes relayctl stop working - * rule reloads are the current suspect - * mwexec('/usr/local/bin/relayctl stop'); - */ - mwexec('pkill relayd'); - } - if (! empty($vs_a)) { - mwexec("/usr/local/sbin/relayd -f {$g['varetc_path']}/relayd.conf"); + if (is_process_running('relayd')) { + if (! empty($vs_a)) { + // it's running and there is a config, just reload + mwexec("/usr/local/bin/relayctl reload"); + } else { + /* + * XXX: Something breaks our control connection with relayd + * and makes 'relayctl stop' not work + * rule reloads are the current suspect + * mwexec('/usr/local/bin/relayctl stop'); + * returns "command failed" + */ + mwexec('pkill relayd'); + } + } else { + if (! empty($vs_a)) { + // not running and there is a config, start it + mwexec("/usr/local/sbin/relayd -f {$g['varetc_path']}/relayd.conf"); + } } + } -?> +?>
\ No newline at end of file |