Synology Network UPS Server - Client Shutdown Script?

Currently reading
Synology Network UPS Server - Client Shutdown Script?

716
388
NAS
RS1221+, RS819, RS217
Operating system
  1. macOS
Mobile operating system
  1. iOS
Begrudgingly bought yet-another replacement UPS; slowly working my way through the major UPS brands...

Anyway, is there a way to send a shutdown command from the Synology UPS Server to a non-Synology client via a task, script or another method?

Ideally I would like a graceful shutdown of a networked Mac mini and a Lenovo (Windows) mini-server, just ahead of my main NAS powering itself down via UPS Safe Mode.

At the moment I have my main NAS connected to my UPS via its single USB port. On power failure the prime NAS sends a shutdown command to the other Synology NASes before powering itself down a minute or so later:

20210314-Syno UPS Server.png


20210314-Syno UPS Info - Eaton.png


I also use a Synology Task Script to wake network clients via Wake-on-LAN - this is a script from my main NAS to a Mac mini server:

20210314-Synology Task Script WoL.png


Finding a way to shutdown the PC and Mac servers is the final piece of my puzzle.

Regards to all.
 
Robbie, while I do have not an answer to your specific question, I have recently been researching options to solve a similar problem – namely, how to gracefully shutdown multiple devices (e.g., Mac, NAS) on a single LAN using one UPS. One approach (yet untested) appears to be built on the following logic, which may be of interest.

  • Purchase a UPS that supports remote (SNMP) management (e.g., CyberPower CP1500PFCLCD + RMCARD205).
  • Connect the UPS remote management port to the router, using an Ethernet cable; with neither the Mac nor the NAS connected to the UPS with a USB cable.
  • Configure the UPS remote management SNMP trap receivers for the Mac and NAS, using the manufacturer’s web interface to the UPS.
  • Install and configure the manufacturer’s power management software on the Mac (e.g., CyberPower Power Panel Business 4 Mac, using “remote” mode).
  • Configure the NAS to receive SNMP traps from the UPS (i.e., UPS type = SNMP).

P.S.: This may also be of interest: How to shutdown multiple devices with single UPS?
 
Purchase a UPS that supports remote (SNMP) management (e.g., CyberPower CP1500PFCLCD + RMCARD205).
My last UPS was a CyberPower and never really happy with it, especially when its battery swelled and cracked the case. I was not really happy with the APC before it with its weird firmware and random fan noise - it also destroyed itself from the inside.

I'm giving a new Eaton a go, so not looking to buying a different UPS.

After digging around on the Linux side of DSM I am starting to understand that the Synology DSM UPS frontend is actually a full version of NUT (Network UPS Tools) under the hood - Synology just packaged the lot and bundled it with DSM6.

I'm guessing that I could use Synology's NUT application (via CLI or a DSM script) to trigger any compliant networked device to receive UPS commands. Not sure how to do that just yet and it would have been more convenient if Synology had exposed more of NUT to the DSM6 GUI.
 
Hello, Robbie. I am curious: have you found a version of NUT that is compatible with macOS?

P.S.: Although I have not used an Eaton UPS, it appears that the company manufacturers network management cards that would enable the approach described previously, in which the UPS (and not the NAS) has sole responsibility for sending SNMP traps to all devices to be shutdown during a power failure.
 
Hello, Robbie. I am curious: have you found a version of NUT that is compatible with macOS?

I used a Fink NUT package years ago and they still list NUT for macOS:


I think there is another package out there too, don't recall the name at the moment.

I have a refurb Eaton card on its way too.
 
While it takes a fair bit of space just to add a few commands, you could use Homebrew on macOS to to add NUT.

Installing Homebrew is covered from this page.

I've installed and use it for a variety of stuff.
 
Robbie, returning to your original problem, here is a straightforward approach to consider that might provide a practical solution:

  • When the NAS receives a power failure notification from the UPS through the attached USB cable, run a script that creates a dummy file (e.g., “ShutDownNow.txt”) on the NAS which functions as a semaphore for the other network devices (PC/Mac); and configure the UPS settings on the NAS to pause for two minutes before beginning shutdown of the NAS. (See here for a sample script.)
  • On each network device (PC/Mac), run a script once every minute that inspects the NAS to determine if the “ShutDownNow.txt” file exists. If yes, then immediately begin a shutdown sequence for the device; if not, do nothing.
  • When the NAS boots following a shutdown, run a startup script that deletes the “ShutDownNow.txt” file, if it exists, in order to reset the process (see here).
 
Robbie, have you found a solution to the challenge of gracefully shutting down multiple devices on a LAN after a power failure? (Thank you.)
 
Last edited:
Robbie, have you found a solution to the challenge of gracefully shutting down multiple devices on a LAN after a power failure? (Thank you.)
Not yet. Just received a network card for my UPS but having a few teething issues with it (it is secondhand so previously configured).

I'm also in the middle of transferring my gear to a larger network rack - doing that whilst trying to keep the network available during waking hours has been a challenge.
-- post merged: --

you welcome:

@jeyare Thanks and I read through it and got a bit lost. Did I miss the bit where clients are shutdown before the NAS as your thread seemed to focus on shutting-down the NAS - apologies if I have misunderstood?
 
two point of view:
1. in my topic you can find the NUT communication described necessary to shutdown the NAS, when the conditions have been met. In my case there are two dependent conditions:
a) UPS on Battery
b) % of battery level
you don't need more for the client side (e.g. computer connected to NAS NUT Server).

For the client side you need:
- NUT client installed
- defined script for NAS server connection - two possible ways:
a) simple:
Bash:
MONITOR ups@<ip of synology> 1 monuser secret slave
b) better:
you can change "localhost" in my code to your NAS IP, then tune the script to better way

you need understand the NUT and Syno NUT integration, reason - why is my topic so heavy
 
Last edited:
Robbie, when time permits, I look forward to hearing more about your experiments using a UPS network management card to initiate a gracefully shutdown of the NAS and other PC/Mac devices on your LAN.

I did have a conversation with a CyberPower senior technical specialist about this topic, confirming my suspicion that the general outline provided above (see post on 15 MAR) should be an effective approach – and, one that has the advantage of bypassing the need to develop and maintain any specialized scripts.
 
Last edited:
the original post has been updated about how to shutdown the Client side also
:coffee:
-- post merged: --

you don't need an investment into management card,
for central operation support of my rack I need just NUT server from Syno
include both PC/Lnx comp connected to the backed socket.
The advantage of the NUT clien's setup is great = single file structure for each OS platforms = 95% same procedure (Copy/Paste).
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

  • Question
Never mind, I found it. Control Panel -> Application Privileges -> Synology Photos -> Edit -> Default...
Replies
1
Views
482
Awoke today to another set of emails about this. Edit. 4-5 hours later, another round! You’d think...
Replies
6
Views
1,779
I found this. Interesting as it seems many modern synology boxes should be able to sync 1-5million files...
Replies
1
Views
1,137
  • Question
When you add share folders on your local PC/Mac, it lists your share folders in the order you added them...
Replies
0
Views
845

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top