I know there’s information on using our Synology NAS’ as UPS servers to power down other Synology devices, but it took me some time to piece together how to use Synology to safely power down my Mac Mini server in the event of a power outage so I figured I’d put it into a writeup here to maybe help some others.
WHY: Most UPS’ only have one USB port to control a single device in the event power outage and the battery running low. If you’re like me, I have my Synology NAS and other devices (i.e. Mac server) that I want all powered down safely.
My setup: These steps are not specific to my hardware/OS/UPS, but figured I’d provide for context.
- APC 600VA UPS
- Synology DS918+
- Mac mini (running Ubuntu server 20.04, not Mac OS X) – this is not specific to Linux, it will work for Mac, Windows servers/computers
- Your router needs to be also attached to the UPS otherwise your NAS and computers/servers won’t be able to communicate.
- Connect NAS to UPS via USB cable.
- Open up DSM and go to Control Panel > Hardware & Power > UPS (tab)
- Enable UPS Support and check “Enable network UPS server”
4. Click “Permitted DiskStation Devices” and input the IP addresses of your servers/computers you would like to power down. In my case, I input the IP of my Mac Mini.
5. Apply settings. If you click, “Device Information” you should see your UPS info. (May require a restart of the NAS, I can’t remember)
Synology is running a NUT Server (http://networkupstools.org) and in this part we have to install the Nut-client to monitor the NAS. I am walking through setup of the Nut-client on Linux, but the same basic steps apply for Mac/Windows. The NUT website has download/install instructions specific to Windows/Mac.
sudo apt-get install nut
2.Modify /etc/nut/nut.conf file to specify your computer/server as a client instead of server. Edit this specific line:
3.Add Synology address and credentials to /etc/nut/upsmon.conf
MONITOR email@example.com 1 monuser secret slave
*Note: these credentials can be changed or you can add a user by SSHing into the NAS and modifying /usr/syno/etc/ups/upsd.users.
4. Lastly, start the nut-client service.
service nut-client restart
Now if I unplug my UPS (to simulate power outage), my Mac will update with the status of the UPS and also will safely shutdown when Synology triggers. I left my Synology settings to trigger shutdown when the UPS battery runs low, but you can check “Time before DiskStation enters Safe Mode” in step 3 above and put a specific time to shutdown.
Windows (Thanks to u/xnaas for providing Windows instructions)
- Download and install the latest binary https://github.com/networkupstools/nut-package-archive/tree/master/windows
During install, uncheck the box for Install libUSB driver
2. Go to the etc folder of your NUT installation folder
Default: C:Program Files (x86)NUTetc
3. Rename or copy nut.conf.sample to nut.conf
4. Rename or copy upsmon.conf.sample to upsmon.conf
5. Edit MODE inside nut.conf
6. Edit upsmon.conf
Find the SHUTDOWNCMD section
Default: SHUTDOWNCMD "/sbin/shutdown -h +0"
Change the default to something like SHUTDOWNCMD
SHUTDOWNCMD "C:\WINDOWS\system32\shutdown.exe -s -t 0"
Customize the time (-t 0) to your liking. Optionally add -f to force the shutdown. If you want to hibernate, replace -s with -h.
Find the MONITOR section and add the following
MONITOR firstname.lastname@example.org 1 monuser secret slave
Make sure to update the IP to your Synology IP
7. Copy libgcc_s_dw2-1.dll from the bin subfolder to the sbin subfolder
8. Download OpenSSL library https://indy.fulgan.com/SSL/
9. Copy libeay32.dll and ssleay32.dll to the sbin subfolder
10. Launch services.msc from Run (WIN+R)
11. Find the service called Network UPS Tools and Start it
To be added later. In the meantime, this wiki should be a good guide: https://github.com/networkupstools/nut/wiki/NUT-on-Mac-OS-X