Install the app
How to install the app on iOS

Follow along with the video below to see how to install our site as a web app on your home screen.

Note: This feature may not be available in some browsers.

Controlled Shutdown of your NAS(es) in case of defined Level of Battery in UPS

As an Amazon Associate, we may earn commissions from qualifying purchases. Learn more...

I have a Cyberpower UPS connected to my NAS, which i want to tell my computer to power down 30 mins after a power cut.



But I can't even work out how to install NUT and get to the GUI.
"Windows (complete port, Beta): Windows MSI installer 2.6.5-6"
Just seems to dump a load of files in Program Files (X86).

Cany anyone give me a pointer please, on how to configure NUT ? I have been able to install it, but none of the information appears to be for Windows, everything is re linux.

What I'm trying to achieve is the NAS to tell the desktop when to shutdown...
 
Last edited:
Guide, how to setup Windows NUT client (incl GUI)


:coffee:
 
Guide, how to setup Windows NUT client (incl GUI)



:coffee:

What a champion - thank you very much.

The odd thing is that DSM and NUT approach shutdown in different ways:

- DSM will shutdown with low battery (amount unknown??), or after x amount of time on battery
- NUT will shutdown if battery less than x, or if runtime is lower than x

So there isn't really a best option for the settings, because it is entirely possible that the DSM shuts down prior to a NUT threshold being reached. It's weird that they would approach the same problem in different ways, or at least, not give you the option to choose one or the other.

So the solution is based on a best guess, rather than being able to say "battery less than 40%: shut down PC, battery less than 30%: shut down NAS"
 
all of my NASes will shut down when the batt level is under <=XX%
when you will setup defined in this thread you will get same option
[automerge]1639667575[/automerge]
Bash:
# For the proper Shutdown of the NAS we have to test 2 scenarios:
# First: UPS in on Battery from the "$STATUS" variable
# Second: UPS battery level is Equal or Lower than variable (in my case = 20%)
if [ $BATINT -le 20 ] && [ $STATUS = 'OB' ];

$BATINT -le 20 ... is the feature
 
Thanks @jeyare . I haven't used bash/ssh at all with the DSM because I am scared of destroying it, only with a Raspberry Pi where I am "practising", so maybe this is something for the future.
 
Thanks @jeyare . I haven't used bash/ssh at all with the DSM because I am scared of destroying it, only with a Raspberry Pi where I am "practising", so maybe this is something for the future.

don't worry, you will use the RESET button a few more times and you will be a master in resetting. I already have a lot of such 'honorable' titles ;)
 
don't worry, you will use the RESET button a few more times and you will be a master in resetting. I already have a lot of such 'honorable' titles ;)
that's what i want to avoid... i have no idea what the rammifications are and as a noob it would take me ages to set everything up again!

then again - i could just back up the config file and assume that would take care of the synology packages.....
 
Updated setup for newbies:

Creation and Edit of the User-defined script for Shutdown
1. Download the attached file "upstest.zip".
2. Unzip it somewhere on your computer.
3. It will create a new file "upstest.sh"
4. Open "upstest.sh" in your preferred simple text editor (no MS Word), e.g. Notepad and make simple edition in row no. 32:
Bash:
if [ $BATINT -le 20 ] && [ $STATUS = 'OB' ];

- there is the number '20' in the code
- it is variably defined value in % of your UPS battery status for the NAS shutdown threshold ... then value 20 means 20% of the battery remains
- you can change the value to whatever value, up to you. 30 = 30%; 25 = 25%
- when the UPS battery will reach this value (%) and NUT upsmon (monitor) will get this information from NUT upsc (status) it will automatically run $SHTD, in this case, SHUTDOWN of the NAS.

Save the file.

Deployment of the "upstest.sh" file to the NAS
1. Use putty or something quite better for 'ssh' into your NAS - in my case I like more the MobaXterm
1640004999816.webp

2. Create a session (plenty of guides here or on the Internet, YT). You need: IP address of the NAS, admin usr/psw.
4. Use 'sudo -i' to get root session
5. In the MobaXterm terminal you can find in the left upper part (arrow) menu for upload a file. But you need to open a working directory first. So open 'opt' directory (this will be not overwritten after NAS upgrade)
1640005254753.webp
click there
when opened, use UPLOAD ICON and upload the file "upstest.sh" into your working directory:
1640005477156.webp

You can use REFRESH green icon (right next to).
So, when everything is OK, then you will see the file "upstest.sh" within 'opt' directory.
6. in the terminal window type:
Bash:
chmod +x /opt/upstest.sh
to allow executable permissions for the file.
Done. Exit the terminal

Define cyclic check of the battery status in DSM
In DSM Control panel / Task Scheduler:
Create / Scheduled task / User-defined script
General tab:
Task: name of the Task ----up to you
User: root
Enabled
1640005935195.webp


Schedule tab:
use these values from screenshot
1640006045090.webp


Task settings tab:
Run command/User-defined script type (use the chosen path to the script):
Bash:
bash /opt/upstest.sh

1640006441246.webp


Done. Use OK, then just check if the Task is ENABLED, select it and use RUN:
1640006592456.webp


Now you can open a beer or two and call me to celebrate this task! 🍻

With this small script you will get:
Controlled Shutdown of your NAS based on EXACT battery level, e.g. 20%.
Performed only when is the UPS on Battery (no one wants shutdown of charged UPS) :cool:

Last recommendation:
- when something is wrong or just for a check, you can find ERROR LOG within:
/var/log/bash_err.log
- right click, then 'Open with Default Text Editor'
- then Ctrl+F upstest.sh to find related error

1640007335860.webp
 

Attachments

  • upstest.zip
    upstest.zip
    634 bytes · Views: 34
  • 1640005376827.webp
    1640005376827.webp
    5.1 KB · Views: 20

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.

Popular tags from this forum

Similar threads

Aha! I have to say I didn't pick that up. In that case, valid point. Hibernation will kick in depending...
Replies
4
Views
148
Have you checked that you do have an Internet routable WAN IP from Virgin Media? You might be able to tell...
Replies
6
Views
930
We use a system similar to what you are describing with installations at remote locations. When setup...
Replies
4
Views
1,085
Welcome. QuickConnect is unique and paired with a dedicated NAS system (serial number) so having a single...
Replies
1
Views
527
  • Question Question
Thanks Rusty. Appreciate the help and your knowledge. :)
Replies
7
Views
1,621

Thread Tags

Tags Tags
case ups

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Trending content in this forum

Back
Top