Does anybody know how to stop a service when there is a power failure using NUT?
I made a custom script like this, the problem is that the script user (NUT) does not have root permissions to stop the service.
I want to stop the boinc-client right after a power failure, so that i do not drain the batteries and start the generator before it's really necessary.
#! /bin/bash
# UPS notify script.
if [$NOTIFYTYPE == "ONBATT"]
then
/etc/init.d/boinc-client stop
fi
/usr/bin/mail -s "UPS '$UPSNAME': $NOTIFYTYPE" [email protected] <<END
$*
END
man sudo
.