Tired of not knowing if your cron-job did finish or threw any errors? Try Alerty and give it a go, you will be amazed of the rapidity of its set up.
Alerty is a minimalistic but easy-to-use service. The set up can be done in less than five minutes with a few clicks.
The infrastructure and code has been designed in a way to be scalable to multiple alerts. It can also handle a ridicolous amount of requests without throwing an unknown or unexpected error.
Alerts are sent via email (by default). This alerts are triggered just right after the call of its Url trigger. They are sent with encryption and following a strict minimalistic style to avoid disctractions, we just want to alert, not entertain.
The simplest way you can check in with the trigger is to use curl and request the url:
curl https://alerty.jaumelopez.dev/trigger.php?t=1v4npa5ps
You can also pass an optional message which via POST
curl -X POST -d "m=message goes here" https://alerty.jaumelopez.dev/trigger.php?t=1v4npa5ps
or the GET method (preferred to encode the URL):
curl https://alerty.jaumelopez.dev/trigger.php?t=1v4npa5ps&m=message%20goes%20here
This can be set up in any type of task, including a coding file which has an HTTP Libaray to send the request, Alerty will work. It also can be placed at the finish of a cronjob.
0 10 * * 1 sudo python3 /path/to/worker.py > /var/log/worker.log && curl -X POST -d "s=$?" https://alerty.jaumelopez.dev/trigger.php?t=1v4npa5ps
This cronjob, apart from updating and upgrading the system every Monday at 10am, it sends an alert by requesting the trigger Url and passes the exit code using the s parameter
Another example but in this case, uploading a log file or artifact, would be as following:
0 10 * * 1 sudo python3 /path/to/worker.py > /var/log/worker.log && curl -X POST -F file=@/var/log/worker.log https://alerty.jaumelopez.dev/trigger.php?t=1v4npa5ps