A script runner that will automatically send an email on script failure.
The script has been tested with the follow. Other versions may also work.
- Bash >= 5.1
- sendemail >= 1.56
Simply clone this repository.
git clone https://github.com/MitMaro/script-email-notifierPlace the script on your PATH, or use the full path to the script.
To update, from the project directory, run:
git pullThe script will automatically run the provided script:
email-notify ./my/script script argumentsThe script is configured using environment variables. These environment variables can be set globally in your shell profile, provided during the script execution, or through any other mechanism for setting environment variables.
EMAILNOTIFY_FROM='me@example.com' email-notify| name | default | required | description |
|---|---|---|---|
| EMAILNOTIFY_SERVER | Yes | The SMTP server to send the email using. | |
| EMAILNOTIFY_TO | Yes | The email address to send the email. | |
| EMAILNOTIFY_SUBJECT | Script Failed To Run | No | The subject of the sent email. |
| EMAILNOTIFY_FROM | admin@ | No | The email who is sending the email. |
| EMAILNOTIFY_SENDEMAIL | sendemail | No | The name or path to sendemail |
This script is used to send an email when cron jobs fails, or to alert on the failure of a background script.
Server Rsync Backup is released under the ISC license. See LICENSE.