i’m an idiot, flip it, I was just reading UPS Shutdown Scripts.md · GitHub and they modify upsmon.conf to run SHUTDOWNCMD “/bin/bash /etc/nut/shutdown.sh >> /var/log/ups/ups.log” so if I just change the upsmon.conf to run the script at shutdown then that should be it
this should in theory work
can ignore below
Regarding midclt call, for the truenas scale nut install the CMDSCRIPT referenced in /etc/nut/upssched.conf points to /usr/local/bin/custom-upssched-cmd, in that script is
midclt call ups.upssched_event ${1}
now that pulls the items from /etc/nut/upssched.conf. If I wanted to also call another script using the same event located in /root/nut called shutdown.sh, how would I do that
The plan is that when the UPS is active and nut kicks in, I would also like ups.upssched_event ${1} to run shutdown.sh as this will ssh to my udm pro and shut it down as well, sadly unifi do not have inbuilt nut support thus the work around
Chatgpt shows
so would something like
midclt call ups.upssched_event ${1} script.run ‘{“script_name”: “/root/nut/shutdown.sh”}’
be it?