Script to run only on ups shutdown

Discussion on apps, protocols, APIs, specifications, and more. You are welcome to join us as a TOS app developer!
Post Reply
User avatar
dmncstech
Posts: 6
Joined: 20 Jun 2023, 04:23

Script to run only on ups shutdown

Post by dmncstech »

I have a script I want to run when the nas is on battery power.

How do I run the following script only on shutdown.


I am using a cp1500pfclcda on the approved list.
This script works standalone, everything shuts down the ups turns off.
When power is restored to the UPS everything powers up correctly.

file name in system: upsshutdown.sh and it is marked executable

#!/bin/bash
# Allow time to shutdown all systems.
upscmd -u username -p password ups load.off.delay 300
upscmd -u username -p password ups load.on.delay 300

# Shutdown Windows 11 Office computer, do not wait
net rpc shutdown -I 192.168.1.124 -U username%password

# Shutdown Windows 11 Gaming computer, do not wait
net rpc shutdown -I 192.168.1.141 -U username%password

# Now shutdown the nas
#shutdown -h "now

Any help will be appreciated.
Post Reply

Return to “Developer Discussion Room”