[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
Roger Price
roger at rogerprice.org
Mon Aug 3 10:33:07 BST 2020
On Sun, 2 Aug 2020, Todd Benivegna wrote:
> How would you write the SHUTDOWNCMD line with multiple commands? I’ve been
> looking at the manual and see that you have to escape the internal “ but am
> still a little confused on how to do this exactly.
This assumes that you use the Bash shell in your default environment. It will
need adaption if you use Dash.
In .bashrc define function getUPSstatus
# Update variable UPSstatus and export to environment
# Usage getUPSstatus <myups>
function getUPSstatus {
export UPSstatus="[$( upsc $1 ups.status 2>/dev/null )]:$( upsc $1 battery.charge 2>/dev/null )"
}
The SHUTDOWNCMD declaration now simplifies to
SHUTDOWNCMD "getUPSstatus <myups> ; logger -t upsmon.conf \"UPS status is $UPSstatus\" ; /sbin/shutdown -h +0"
Roger
More information about the Nut-upsuser
mailing list