offbattery.j2 419 B

12345678910111213141516171819
  1. #!/bin/sh
  2. # {{ ansible_managed }}
  3. #
  4. # This shell script if placed in /etc/apcupsd
  5. # will be called by /etc/apcupsd/apccontrol when the
  6. # UPS goes back on to the mains after a power failure.
  7. # We send an ntfy message to notify
  8. #
  9. message=$(/sbin/apcaccess status)
  10. curl \
  11. -H "Title: UPS Power has returned" \
  12. -H "Priority: default" \
  13. -H "Tags: +1" \
  14. -d "$message" \
  15. {{ ntfy_url }}/{{ ntfy_topic }}
  16. exit 0