Setup for Ubuntu Server:
I run Ubuntu server up-to-date and, for CyberPower CP1500EPFCLCD UPS, I installed the PowerPanel Personal for Linux x64, from official website, www.cyberpower.com.
I read the official manual and these:
https://forum.storj.io/t/psa-nut-cyberpower-ups-and-freebsd/25829?u=snorkel
and
https://networkupstools.org/docs/man/usbhid-ups.html
I set up the configurations, unplugged the UPS from then wall and it stopped the PC after the specified delay (5 min), than started to count down 600 sec on it’s display (the default shutdown-sustain = 600
).
When UPS reached 0, nothing happened, it didn’t turn off.
I plugged the UPS back to wall and the PC didn’t start. The UPS kept showing 0 till shutdown.
I unplugged the PC from UPS and plugged it back, and it booted.
So, setting shutdown-sustain = 600
messes it up. It’s the same parameter as in NUT, offdelay
.
After all that reading, I tried to setting it to 0 (zero) and voila; it worked.
Setting shutdown-sustain = 0
in PowerPanel or offdelay=0
in NUT, makes these chain of events possible:
1.the UPS will shutdown the PC after the specified delay (like powerfail-delay = 300
);
2.when powering off, the PC will send the shutdown command to UPS;
3.the UPS will count down 60 seconds and will power down (so 0 will give you a delay of 60 sec).
4.when power is restored, the UPS powers on and the PC a few seconds later.
These are the commands I use:
# download the deb file from official website
sudo dpkg -i /path-to-file/file-name.deb
sudo dpkg -r powerpanel
# docs
cat /usr/share/doc/powerpanel
# commands
man pwrstat
man pwrstatd
pwrstat -help
pwrstat -version
pwrstat -status
pwrstat -config
# settings for pwrstat
sudo su
pwrstat -alarm off
pwrstat -pwrfail -delay 300 -active on -cmd /etc/pwrstatd-powerfail.sh -duration 1 -shutdown on
pwrstat -lowbatt -runtime 900 -capacity 35 -active on -cmd /etc/pwrstatd-lowbatt.sh -duration 1 -shutdown on
exit
# settings for pwrstatd
sudo su
nano /etc/pwrstatd.conf
shutdown-sustain = 0 # shuts down the PC and gives 1 min delay; other values are not supported
/etc/init.d/pwrstatd restart
/etc/init.d/pwrstatd status
exit
# logs
/var/log/pwrstatd.log
These are the resulting parameters:
pwrstat version 1.4.1 - Linux x64bit
powerfail-delay = 300
powerfail-active = yes
powerfail-cmd-path = /etc/pwrstatd-powerfail.sh
powerfail-duration = 1
powerfail-shutdown = yes
lowbatt-threshold = 35
runtime-threshold = 900
lowbatt-active = yes
lowbatt-cmd-path = /etc/pwrstatd-lowbatt.sh
lowbatt-duration = 1
lowbatt-shutdown = yes
enable-alarm = no
shutdown-sustain = 0
turn-ups-off = yes
ups-polling-rate = 3
ups-retry-rate = 10
prohibit-client-access = no
allowed-device-nodes =
hibernate = no
cloud-active = no
cloud-account =
I didn’t set up email notifications. You can with those shell scripts.
Explanations: when power outage occurs, the PC is shutdown after 300 sec, than, after 1 minute, the UPS shuts down. If the battery is low, the PC will shutdown when there remains less than 900 sec of runtime or 35% battery cappacity. I don’t know the UPS power off delay here; didn’t test it. When power is restored and the battery has enough juice, the UPS powers on and almost instantly, or after a very short delay, the PC is powered on. Of course, you have to properly set the BIOS.
Setup for Synology NAS:
The UPS will power off after NAS stopped the drives and leds are blinking like before powering off, without a delay like in the PC case. I can’t figure it out if the NAS finished all the chores, but the drives are stopped, which is good. I will try to record both situations, with that setting on and off, to see if it’s any difference for the NAS.
From what I’ve read, Synology uses NUT, so maybe we can teak some settings under the hood.