commok.j2 448 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 apcupsd
  6. # restores contact with the UPS (i.e. the serial connection is restored).
  7. # We send an ntfy message to notify
  8. #
  9. message=$(/sbin/apcaccess status)
  10. curl \
  11. -H "Title: Communications with UPS restored" \
  12. -H "Priority: default" \
  13. -H "Tags: +1" \
  14. -d "$message" \
  15. {{ ntfy_url }}/{{ ntfy_topic }}
  16. exit 0