Commit 0ceaef12 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(captive portal) add service to status page, closes https://github.com/opnsense/core/issues/771

(cherry picked from commit 705d1e50)
parent 78002c42
......@@ -2680,6 +2680,23 @@ function get_services() {
if (isset($config['OPNsense']['IDS']['general']['enabled']) && $config['OPNsense']['IDS']['general']['enabled'] == 1) {
$services[] = array('name'=>'suricata', 'description' => gettext("Intrusion Detection"));
}
if (isset($config['OPNsense']['captiveportal']['zones']['zone'])) {
$enabled = false;
if (!empty($config['OPNsense']['captiveportal']['zones']['zone']['enabled'])) {
// single zone and enabled
$enabled = true;
} else {
// possible more zones, traverse items
foreach ($config['OPNsense']['captiveportal']['zones']['zone'] as $zone) {
if (!empty($zone['enabled'])) {
$enabled = true;
}
}
}
if ($enabled) {
$services[] = array('name'=>'captiveportal', 'description' => gettext("Captive Portal"));
}
}
$services[] = array('name'=>'configd', 'description' => gettext("System Configuration Daemon"));
......@@ -2724,6 +2741,9 @@ function get_service_status($service)
case 'configd':
$running = isvalidpid('/var/run/configd.pid');
break;
case 'captiveportal':
$running = isvalidpid('/var/run/lighttpd-api-dispatcher.pid');
break;
default:
$running = is_process_running($service['name']);
break;
......
......@@ -129,6 +129,9 @@ function service_control_start($name, $extras) {
case 'configd':
mwexec('/usr/local/etc/rc.d/configd start');
break;
case 'captiveportal':
configd_run("captiveportal start");
break;
default:
log_error(sprintf(gettext("Could not start unknown service `%s'"), $name));
break;
......@@ -201,6 +204,9 @@ function service_control_stop($name, $extras) {
case 'configd':
killbypid("/var/run/configd.pid");
break;
case 'captiveportal':
configd_run("captiveportal stop");
break;
default:
log_error(sprintf(gettext("Could not stop unknown service `%s'"), $name));
break;
......@@ -273,6 +279,9 @@ function service_control_restart($name, $extras) {
case 'configd':
mwexec('/usr/local/etc/rc.d/configd restart');
break;
case 'captiveportal':
configd_run("captiveportal restart");
break;
default:
log_error(sprintf(gettext("Could not restart unknown service `%s'"), $name));
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment