services: tracer code for start logic into service array

This commit is contained in:
Franco Fichtner 2016-02-20 12:38:49 +01:00
parent aa8202aa3c
commit 77696bd81e
2 changed files with 13 additions and 6 deletions

View File

@ -2606,6 +2606,7 @@ function services_get()
$pconfig = array();
$pconfig['name'] = "apinger";
$pconfig['description'] = gettext("Gateway Monitoring Daemon");
$pconfig['php']['start'] = 'setup_gateways_monitor';
$services[] = $pconfig;
}
@ -2642,6 +2643,7 @@ function services_get()
$pconfig = array();
$pconfig['name'] = 'sshd';
$pconfig['description'] = gettext('Secure Shell Daemon');
$pconfig['configd']['start'] = 'sshd restart';
$services[] = $pconfig;
}

View File

@ -90,6 +90,17 @@ function service_control_start($name, $extras)
return sprintf(gettext("Could not start unknown service `%s'"), htmlspecialchars($name));
}
if (isset($service['configd']['start'])) {
configd_run($service['configd']['start']);
/* XXX fall through later */
return sprintf(gettext('%s has been started via configd.'), htmlspecialchars($name));
} elseif (isset($service['php']['start'])) {
$service['php']['start']();
/* XXX fall through later */
return sprintf(gettext('%s has been started via php.'), htmlspecialchars($name));
}
/* XXX migrate all of those */
switch ($service['name']) {
case 'radvd':
services_radvd_configure();
@ -97,9 +108,6 @@ function service_control_start($name, $extras)
case 'ntpd':
system_ntp_configure();
break;
case 'apinger':
setup_gateways_monitor();
break;
case 'bsnmpd':
services_snmpd_configure();
break;
@ -127,9 +135,6 @@ function service_control_start($name, $extras)
case 'ipsec':
vpn_ipsec_force_reload();
break;
case 'sshd':
configd_run("sshd restart");
break;
case 'relayd':
relayd_configure();
filter_configure();