Browse Source

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

nut: Prevent FSD when not specifically requested
lilik-openwrt-22.03
Hannu Nyman 6 years ago
committed by GitHub
parent
commit
882b497753
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      net/nut/files/nutshutdown

+ 10
- 7
net/nut/files/nutshutdown 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"
/lib/nut/${driver} -a "$cfg" -k
# Only FSD if killpower was indicated
if [ -f /var/run/killpower ]; then
/lib/nut/${driver} -a "$cfg" -k
fi
} }
[ -f /var/run/killpower ] && {
[ -f /etc/config/nut_server ] && {
if [ -f /var/run/killpower ]; then
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…
Cancel
Save