How critical to do graceful shutdown on power outage?
Trying to figure out a new UPS (and open to any and all advice!). The UPS will power network (7 UI switches, POE AP's, POE Cameras, modem, etc.), Synology 3618 NAS, and SS (Mac Mini). Likely an APC SRT1500RMXLA
Shutdown notification is via a single USB. Easiest is to connect this to the NAS and let everything else, including SS Mac Mini, experience an ungraceful power loss. I think all of the network s/b OK. SS?
I think the only alternative is to run NUT on the SS Mac Mini and point it towards the NAS. Has anyone done this?
Then there's the issue of auto restart. I assume if I do a graceful shutdown and it then looses power that when it sees power again it will restart, load SS, etc. ?
What about if power comes back before it it sees a loss of power?
Thanks
Comments
It's certainly not ideal for the Mac to lose power, but it depends how often this is likely to occur. If it will be an infrequent occurrence (e.g. once per month) then it's probably nothing to worry about too much. macOS does several safety checks as it starts up, including repairing any damage to the file system on the boot drive if necessary. And SecuritySpy itself has mechanisms to repair captured files that were improperly closed.
If you can work out a way to implement a graceful shutdown then that would certainly be preferable, but then you have the problem of how to boot up the Mac when the power comes back on, as this won't happen automatically. One way would be to add a daily startup schedule every day via the Energy Saver system preference, but this could result in up to a whole day of downtime. The advantage of letting the Mac experience a power failure is that you can use the option (also in the Energy Saver system pref) to automatically start up after a power failure, which will minimise downtime.
Thanks Ben. Power outages for us are somewhat rare, perhaps 3x / yr. But even one can sometimes be problematic. I think letting the SS mac simply fail so that it will restart, which is our current situation, is still best.
Would there be much benefit in SS itself having the capability to do a graceful shutdown prior to a UPS power loss or is simply loosing power not a huge issue?
I think it's beyond the scope of SecuritySpy to implement some kind of USB communication with UPS power supplies. This would not be a trivial thing to implement, and would have no benefit for almost all users. Power loss can cause problems and should certainly be avoided, but three times per year is quite minimal and I think you would have to be rather unlucky to experience damage caused by such infrequent power loss.
Thanks Ben.
Do you know what is lost with an ungraceful shutdown? Are video files useable up to the power loss? Or up to some point prior to the power loss? Or any currently open files are lost?
BTW, I think NUT does all of the heavy lifting of monitoring the UPS. I believe apps like SS just monitor the local NUT client to know if they should shut down before power is lost.
This may well be totally unnecessary but thought I'd mention it.
I'm not at all familiar with NUT - does it not have any option to shut down the Mac itself?
SecuritySpy has backup mechanisms in place for captured files, to fix any damage caused by power loss. So you shouldn't lose a significant amount of video data when this happens. More concerning is potential drive corruption, but macOS has mechanisms in place to make this unlikely.
Synology DSM has a built-in Network UPS Tools (NUT) server at Control Panel > Hardware & Power > UPS.
If you enable the network UPS server there and specify the IP addresses of the computers you want to shut down in the event of a power outage, then you can install NUT on each of those computers and configure each one to listen and respond to events.
I installed NUT with homebrew (
brew install nut
) to save time on my computers. Here are sample confirmation files (located in your homebrew directory atetc/nut
):nut.conf:
MODE=netclient
upsd.users:
[monuser]
password = secret
upsmon slave
upsmon.conf:
MONITOR ups@nas_host_name 1 monuser secret slave
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD ~/Documents/Scripts/notify
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG ~/.homebrew/etc/nut/killpower
NOTIFYFLAG ONLINE SYSLOG
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
NOTIFYFLAG COMMOK SYSLOG
NOTIFYFLAG COMMBAD SYSLOG+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+EXEC
NOTIFYFLAG REPLBATT SYSLOG+EXEC
NOTIFYFLAG NOCOMM SYSLOG+EXEC
NOTIFYFLAG NOPARENT SYSLOG+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
My
~/Documents/Scripts/notify
is just a Ruby script I wrote that that accepts the UPS message as an argument , displays a notification showing that UPS message on the computer (for Macs, I use theosascript -E 'display notification blah blah blah'
command), and sends an email to me with the UPS message.The
~/.homebrew/etc/nut/killpower
script isn't used in slave mode, so you can ignore it.