Skip to content

Instantly share code, notes, and snippets.

@Mic92
Last active February 25, 2023 14:21
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mic92/a8d202598d222bbc5542b5a95faa859f to your computer and use it in GitHub Desktop.
Save Mic92/a8d202598d222bbc5542b5a95faa859f to your computer and use it in GitHub Desktop.
Sent pushover warnings when a systemd service failed (useful for backups and systemd timers)
[Unit]
Description=pushover warning
[Service]
Type=oneshot
ExecStart=/usr/bin/curl -s \
--form-string "token=<PUSHOVER_APPLICATION_TOKEN>" \
--form-string "user=<PUSHOVER_USER_TOKEN>" \
--form-string "message=service %I at %H failed" \
https://api.pushover.net/1/messages.json
[Unit]
Description=rsnapshot (%I) backup
# if the task fails pushover-warning will be triggered.
OnFailure=pushover-warning@%n.service
[Service]
Type=oneshot
Nice=19
IOSchedulingClass=3
ExecStart=/usr/bin/rsnapshot %I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment