Answer the question
In order to leave comments, you need to log in
Is it necessary that information about an unsuccessful launch through the crontab of any task be sent to a specific email?
There is a php script /home/clients/test_ftp0/domains/ example.com/html/sendEmail.php . It is set to 00 9,15 * * 1,3,5 wget example.com/sendEmail.php . How can I make sure that all error information from all domains on this account is sent to a specific email address?
Answer the question
In order to leave comments, you need to log in
at the beginning of the crontab ( sudo -u %username% crontab -e
) add a line
MAILTO=
with the desired soap.
And set the STDOUT output of the command to /dev/null so that successful executions do not arrive to you.
[email protected]
0 */2 * * * /bin/backup.sh > /dev/null
we set set_error_handler throwing ErrorException (see manual) and wrap the code in try / catch, in the catch block we log the error using syslog, to open the log we use openlog with the argument facility = LOG_MAIL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question