Is there a way to reuse a script when the UPS shuts down my Mac

I have a Mac Studio running macOS Tahoe. I have a NAS connected and would like to send a command to the NAS to shut down when the UPS shuts down the Mac Studio. I don't see any way to configure the UPS to run a script when it shuts down. I don't want to shut down the NAS every time I shut down or restart the computer I only want it to shut down the NAS on a power failure when the UPS Battery level drops below a certain level.

Is this something that I can do with or without a third party package. The UPS is an APC and there is no software from the vendor that works with a MAC.

Thanks

Dan

Mac Studio (2022)

Posted on Oct 11, 2025 1:37 PM

Reply
1 reply

Oct 11, 2025 6:59 PM in response to DanDalio

I don't have a complete answer for you but I might be able to point you in the right direction. The solution would be to add a property list to /Library/LaunchDaemons/ that executes that command to the NAS upon system shutdown. You will have to determine or write that command; it's probably a shell script but all I can do is guess.


This assumes Energy Saver has been properly configured to shut down the Mac at a specified time and / or UPS battery charge state and that it actually initiates a system shutdown in the same manner as you would manually.


For an example read https://github.com/freedev/macosx-script-boot-shutdown/tree/master


Caveats:


  1. it's old, and
  2. I have no way to verify it will work.


However, it seems reasonable and should work.

Is there a way to reuse a script when the UPS shuts down my Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.