Updated on Oct 13, 2021
When the cronjob is executed and the job cannot run normally it will send an email to the root user. The output of a successfully executed cron job or script will be sent via email to your local mail account. If you would like to stop receiving output for the executed cronjob no matter if the same is successfully executed or not you will need to add one of the following strings at the end of the cron job command:
For example after the authentication in your cPanel account click on the “Cron Jobs” icon from the “Advanced” section. On the following page, you will notice an “Email” field, here you should put the email for cron job notifications. After the email and all of the time execution fields at the bottom is the “Command” field where the same should be set with the following commands:
cd /home/user/public_html/cron.php > /dev/null 2>&1
cd /home/user/public_html/cron.php &> /dev/null
No matter which of the commands you choose and set, the email notifications upon execution of the cron job will be interrupted.
Another way to prevent email notifications is to edit your cron job file. After the cron job file is opened and ready for editing you should add the following line at the top of the cron job file:
This also will prevent the email notifications of the cron job.
We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!