Merge pull request #7910 from cshoredaniel/pr-nut-fsd-bug

nut: Prevent FSD when not specifically requested
This commit is contained in:
Hannu Nyman 2019-01-13 09:45:43 +02:00 committed by GitHub
commit 882b497753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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