Although there is no new version of network shutdown for Mac if you have a Mac and want to be able to have it shut down and come back on this article is for you. In my initial testing I was able to get the Mac to shutdown fine, but when the UPS would cycle the power it wouldn’t boot back up.
The reason for this is Powerchute Network Shutdown does a graceful shutdown and that doesn’t prime the system to reboot when the power cuts out. In terms of shutting down a Mac so it reboots when the power comes back the Mac you need is adding a -U flag to the shutdown. The Man page for shutdown tells us the following:
-u The system is halted up until the point of removing system power, but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. macOS uses this mode automatically with supported UPSs in emergency shutdowns.
The good news is that we can tell Network Shutdown to run a custom script instead and shutdown using the -u flag. So first you will need to create a new file. It is up to where you place it. I created a /apc-networkshutdown/ folder to keep it in. Since I like to keep things simple I just named the file “shutdown”. Here is all you need in it:
#!/bin/sh /sbin/shutdown -hu now +$1 "PowerChute Network Shutdown has initiated a system shutdown."
As already mentioned the magic here is addition of the “u” flag that the shutdown command that was originally being called didn’t have. Next we need to make sure it can be executed.
chown root:wheel /apc-shutdown/shutdown chmod 744 /apc-shutdown/shutdown
Now you have to let network shutdown know to run this shutdown script instead of the one it came with to do that you will need to edit the pcnsconfig.ini file. In a typical install that file will be buried in all kinds of sub folders at /Users/Shared/Applications/APC/PowerChute/group1/pcnsconfig.ini you want to set the “shutdownCommand” to this
shutdownCommand = /apc-shutdown/shutdown
At this point you just need to restart your computer and you should be good to go. As an added bit of security to ensure your system will come back up you can also edit the original shutdown script the it use by default and change the “-h” there to a “-hu” as well.
ONE LAST STEP! The big thing to note here is that you can’t just shutdown like this and assume you are good! If your APC doesn’t cut power to the system within the 5 minute window it won’t come back on later. The best way to do this is to set your network shutdown settings to cut the power after the machine shutdown. In my case I have that set with a 4.5 minute delay. I have also set my battery backup to ONLY bring back the machine once it is charged back up to at least 80%. Your settings and level of UPS will determine how detailed you can get with those things.