Skip to content

Commit

Permalink
sysutils/nut: proper service logic
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed May 6, 2018
1 parent b6b677f commit 448f4e1
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions sysutils/nut/src/etc/inc/plugins.inc.d/nut.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 448f4e1

Please sign in to comment.