#!/bin/sh # {{ ansible_managed }} # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the UPS # goes on batteries. # We send an ntfy message to notify # message=$(/sbin/apcaccess status) curl \ -H "Title: [$(hostname)] - Running off UPS Battery !!!" \ -H "Priority: urgent" \ -H "Tags: warning" \ -d "$message" \ {{ ntfy_url }}/{{ ntfy_topic }} exit 0