Add relayd to Status > Services and widget. Add capability to kill when restarting instead of a simple reload. Implements #1913

This commit is contained in:
jim-p 2011-09-28 11:38:05 -04:00
parent a5566aa8a9
commit d353423564
3 changed files with 32 additions and 3 deletions

View File

@ -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

View File

@ -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;

View File

@ -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");