#!/bin/sh # {{ ansible_managed }} # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when apcupsd # loses contact with the UPS (i.e. the serial connection is not responding). # We send an ntfy message to notify # message=$(/sbin/apcaccess status) curl \ -H "Title: [$(hostname)] - Communications with UPS lost" \ -H "Priority: urgent" \ -H "Tags: warning" \ -d "$message" \ {{ ntfy_url }}/{{ ntfy_topic }} exit 0