Using Monit to Email a Notification when script is ran

Started by xxavvv123, December 26, 2023, 03:59:42 PM

Previous topic - Next topic
December 26, 2023, 03:59:42 PM Last Edit: December 26, 2023, 04:41:43 PM by xxavvv123
Merry day after Christmas to everyone!

I have email notifications setup and working as expected in Monit.
I have a crontab setup to run a certain script 1-2 times a month.

How can I have monit send out an email everytime this script is ran?

Hi
I would try to add logging to a file to the script (something like "super-duper script completed successfully/with an error"), then add log-file monitoring (https://docs.opnsense.org/manual/monit.html#example-3) in monit for "super-duper" content: in this case the line from the log will be sent to your email  ;)