mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
sysutils/nut: proper service logic
PR: https://forum.opnsense.org/index.php?topic=7759.0
This commit is contained in:
parent
b6b677f8d1
commit
448f4e1c8c
1 changed files with 27 additions and 22 deletions
|
|
@ -44,30 +44,35 @@ function nut_services()
|
|||
{
|
||||
$services = array();
|
||||
|
||||
if (nut_enabled()) {
|
||||
$services[] = array(
|
||||
'description' => gettext('Network UPS Tools'),
|
||||
'configd' => array(
|
||||
'restart' => array('nut restart'),
|
||||
'start' => array('nut start'),
|
||||
'stop' => array('nut stop'),
|
||||
),
|
||||
'name' => 'nut',
|
||||
'pidfile' => '/var/db/nut/upsd.pid'
|
||||
);
|
||||
if (!nut_enabled()) {
|
||||
return $services;
|
||||
}
|
||||
if (nut_enabled() && nut_netclient()) {
|
||||
$services[] = array(
|
||||
'description' => gettext('Network UPS Monitor'),
|
||||
'configd' => array(
|
||||
'restart' => array('nut restart'),
|
||||
'start' => array('nut start'),
|
||||
'stop' => array('nut stop'),
|
||||
),
|
||||
'name' => 'upsmon',
|
||||
'pidfile' => '/var/db/nut/upsmon.pid'
|
||||
);
|
||||
|
||||
$services[] = array(
|
||||
'description' => gettext('Network UPS Monitor'),
|
||||
'configd' => array(
|
||||
'restart' => array('nut restart'),
|
||||
'start' => array('nut start'),
|
||||
'stop' => array('nut stop'),
|
||||
),
|
||||
'pidfile' => '/var/db/nut/upsmon.pid',
|
||||
'name' => 'upsmon',
|
||||
);
|
||||
|
||||
if (nut_netclient()) {
|
||||
return $services;
|
||||
}
|
||||
|
||||
$services[] = array(
|
||||
'description' => gettext('Network UPS Tools'),
|
||||
'configd' => array(
|
||||
'restart' => array('nut restart'),
|
||||
'start' => array('nut start'),
|
||||
'stop' => array('nut stop'),
|
||||
),
|
||||
'pidfile' => '/var/db/nut/upsd.pid',
|
||||
'name' => 'nut',
|
||||
);
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue