Skip to content

Instantly share code, notes, and snippets.

@epilys
Created January 31, 2024 07:20
Show Gist options
  • Save epilys/fb12af6e8f3886d42aa2a7d9e241e055 to your computer and use it in GitHub Desktop.
Save epilys/fb12af6e8f3886d42aa2a7d9e241e055 to your computer and use it in GitHub Desktop.
systemd service to send you an email on failure
[Unit]
Description=status email for %i to user
[Service]
Type=oneshot
ExecStart=/usr/local/bin/systemd-email user@example.com %i
User=debian
Group=systemd-journal
## Example usage:
## Add the following under a service unit file's [Unit] section:
## [Unit]
## OnFailure=status_email_debian@%n.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment