aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2009-04-19 19:14:43 -0400
committerjim-p <jim@pingle.org>2009-04-19 19:14:43 -0400
commitfb943fce8920492f4c510dd983138b40c6e28a9f (patch)
tree29675b8758d13a1562fe43b8e7b620f795554419
parent8e2350446a781758916dc7e17030b891f6dfd7c2 (diff)
downloadpfsense-packages-fb943fce8920492f4c510dd983138b40c6e28a9f.tar.gz
pfsense-packages-fb943fce8920492f4c510dd983138b40c6e28a9f.tar.bz2
pfsense-packages-fb943fce8920492f4c510dd983138b40c6e28a9f.zip
Add an option to the NUT package that will let the user choose to power down (shutdown -p) instead of halt. Should fix Ticket #1882
Shutdown -p will only work on supported systems. Since the behavior on unsupported systems is unknown, giving the user a choice seemed like the better way.
-rw-r--r--config/nut/nut.inc7
-rw-r--r--config/nut/nut.xml5
2 files changed, 10 insertions, 2 deletions
diff --git a/config/nut/nut.inc b/config/nut/nut.inc
index a8465dce..987dbe83 100644
--- a/config/nut/nut.inc
+++ b/config/nut/nut.inc
@@ -172,6 +172,7 @@
$remoteaddr = nut_config('remoteaddr');
$remoteuser = nut_config('remoteuser');
$remotepass = nut_config('remotepass');
+ $shutdownflag = (nut_config('powerdown') == 'on') ? '-p' : '-h';
if(!($remotename && $remoteaddr && $remoteuser && $remotepass))
return false;
@@ -180,7 +181,7 @@
$upsmon_conf = <<<EOD
MONITOR {$remotename}@{$remoteaddr} 1 {$remoteuser} {$remotepass} slave
MINSUPPLIES 1
-SHUTDOWNCMD "/sbin/shutdown -h +0"
+SHUTDOWNCMD "/sbin/shutdown {$shutdownflag} +0"
POWERDOWNFLAG /etc/killpower
EOD;
@@ -218,6 +219,8 @@ EOD;
$allowaddr = nut_config('allowaddr');
$allowuser = nut_config('allowuser');
$allowpass = nut_config('allowpass');
+ $shutdownflag = (nut_config('powerdown') == 'on') ? '-p' : '-h';
+
if(!($name && $driver && $port))
return false;
@@ -276,7 +279,7 @@ EOD;
$upsmon_conf = <<<EOD
MONITOR {$name}@localhost 1 monuser mypass master
MINSUPPLIES 1
-SHUTDOWNCMD "/sbin/shutdown -h +0"
+SHUTDOWNCMD "/sbin/shutdown {$shutdownflag} +0"
POWERDOWNFLAG /etc/killpower
EOD;
diff --git a/config/nut/nut.xml b/config/nut/nut.xml
index fdaa6295..0bd91adf 100644
--- a/config/nut/nut.xml
+++ b/config/nut/nut.xml
@@ -468,6 +468,11 @@
</options>
</field>
<field>
+ <fielddescr>Power Down Instead of Halt</fielddescr>
+ <fieldname>powerdown</fieldname>
+ <type>checkbox</type>
+ </field>
+ <field>
<fielddescr>Local Remote Access Address &lt;br&gt;(ex: 192.168.1.0/24)</fielddescr>
<fieldname>allowaddr</fieldname>
<type>input</type>