From d353423564517a5038f57996769cb488ec802d7a Mon Sep 17 00:00:00 2001 From: jim-p Date: Wed, 28 Sep 2011 11:38:05 -0400 Subject: Add relayd to Status > Services and widget. Add capability to kill when restarting instead of a simple reload. Implements #1913 --- etc/inc/vslb.inc | 11 ++++++++--- usr/local/www/status_services.php | 17 +++++++++++++++++ .../www/widgets/widgets/services_status.widget.php | 7 +++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index 54416b9..064438e 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -159,7 +159,7 @@ function echo_lbaction($action) { return $ret; } -function relayd_configure() { +function relayd_configure($kill_first=false) { global $config, $g; $vs_a = $config['load_balancer']['virtual_server']; @@ -281,8 +281,13 @@ function relayd_configure() { if (is_process_running('relayd')) { if (! empty($vs_a)) { - // it's running and there is a config, just reload - mwexec("/usr/local/sbin/relayctl reload"); + if ($kill_first) { + mwexec('pkill relayd'); + mwexec("/usr/local/sbin/relayd -f {$g['varetc_path']}/relayd.conf"); + } else { + // it's running and there is a config, just reload + mwexec("/usr/local/sbin/relayctl reload"); + } } else { /* * XXX: Something breaks our control connection with relayd diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 2303054..5061213 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -42,6 +42,7 @@ require_once("captiveportal.inc"); require_once("service-utils.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); +require_once("vslb.inc"); function gentitle_pkg($pgname) { global $config; @@ -101,6 +102,9 @@ if($_GET['mode'] == "restartservice" and !empty($_GET['service'])) { } } break; + case 'relayd': + relayd_configure(true); + break; default: restart_service($_GET['service']); break; @@ -145,6 +149,9 @@ if($_GET['mode'] == "startservice" and !empty($_GET['service'])) { mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}"); } break; + case 'relayd': + relayd_configure(); + break; default: start_service($_GET['service']); break; @@ -201,6 +208,9 @@ if($_GET['mode'] == "stopservice" && !empty($_GET['service'])) { killbypid($pidfile); } break; + case 'relayd': + mwexec('pkill relayd'); + break; default: stop_service($_GET['service']); break; @@ -337,6 +347,13 @@ foreach (array('server', 'client') as $mode) { } } +if (count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) { + $pconfig = array(); + $pconfig['name'] = "relayd"; + $pconfig['description'] = gettext("Server load balancing daemon"); + $services[] = $pconfig; +} + function service_name_compare($a, $b) { if (strtolower($a['name']) == strtolower($b['name'])) return 0; diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index f41e7f5..054c7f6 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -152,6 +152,13 @@ foreach (array('server', 'client') as $mode) { } } +if (count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) { + $pconfig = array(); + $pconfig['name'] = "relayd"; + $pconfig['description'] = gettext("Server load balancing daemon"); + $services[] = $pconfig; +} + if(isset($_POST['servicestatusfilter'])) { $config['widgets']['servicestatusfilter'] = $_POST['servicestatusfilter']; write_config("Saved Service Status Filter via Dashboard"); -- cgit v1.1