diff options
Diffstat (limited to 'config/nut')
-rw-r--r-- | config/nut/nut.inc | 7 | ||||
-rw-r--r-- | config/nut/nut.xml | 5 |
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 <br>(ex: 192.168.1.0/24)</fielddescr> <fieldname>allowaddr</fieldname> <type>input</type> |