Merge pull request #7910 from cshoredaniel/pr-nut-fsd-bug
nut: Prevent FSD when not specifically requested
This commit is contained in:
commit
882b497753
1 changed files with 10 additions and 7 deletions
|
@ -16,11 +16,14 @@ stop_instance() {
|
||||||
shutdown_instance() {
|
shutdown_instance() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
config_get driver "$cfg" driver "usbhid-ups"
|
config_get driver "$cfg" driver "usbhid-ups"
|
||||||
|
# Only FSD if killpower was indicated
|
||||||
|
if [ -f /var/run/killpower ]; then
|
||||||
/lib/nut/${driver} -a "$cfg" -k
|
/lib/nut/${driver} -a "$cfg" -k
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -f /var/run/killpower ] && {
|
if [ -f /var/run/killpower ]; then
|
||||||
[ -f /etc/config/nut_server ] && {
|
if [ -f /etc/config/nut_server ]; then
|
||||||
config_load nut_server
|
config_load nut_server
|
||||||
|
|
||||||
# Can't FSD unless drivers are stopped
|
# Can't FSD unless drivers are stopped
|
||||||
|
@ -33,9 +36,9 @@ shutdown_instance() {
|
||||||
sleep 120
|
sleep 120
|
||||||
# Uh-oh failed to poweroff UPS
|
# Uh-oh failed to poweroff UPS
|
||||||
reboot -f
|
reboot -f
|
||||||
} || {
|
else
|
||||||
poweroff
|
poweroff
|
||||||
}
|
fi
|
||||||
} || {
|
else
|
||||||
poweroff
|
poweroff
|
||||||
}
|
fi
|
||||||
|
|
Loading…
Reference in a new issue