Guide on how to save the output of the cronjob and disable email delivery

    1. The first step is to log in to your terminal.

    2. Open cronjob by typing crontab -e

    3. Here's an example of cronjob syntax to issue and log the output results of a cron job.



* * * * * php /home/xxx/public_html/helloworld.php >> /home/xxx/public_html/cronjob.log 2>&1

It can be seen that the output of the cron job will be saved in /home/xxx/public_html/cronjob.log with each running action ending with enter.


But sometimes every time a cronjob runs, there is a report sent via a certain email. So here how do you turn off the email notification?

  1. Enter crontab -e
  2. Look at the cronjob line that you want to turn off email notifications, it will look like this result
    * * * * * php /home/xxx/public_html/helloworld.php >> /dev/null 2>&1

  3. Make sure at the very top of the crontab there is no MAILTO, if there is please delete it.
    MAILTO=email@example.com

  4. Thus, no notification email is sent.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.