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?
- Enter crontab -e
- 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
Make sure at the very top of the crontab there is no MAILTO, if there is please delete it.
MAILTO=email@example.com
- Thus, no notification email is sent.