[Solved] Why my cronjob not emailing me after it’s done?
It’s an important thing that every cPanel owner must read before setting up Cronjobs. This is simple to setup a cronjob via cPanel. You can also set an email address there to get alerts every time that the cron runs. We’ve already discussed how setup cronjobs via command line, see the section “crontab command and switches.” Also read the example section “10+ examples of Job Scheduling Using Crontab.”
Simply cronjobs executes/runs whatever we want at regular interval of times. Here we go;
How can I setup cronjob via cPanel?
It’s simple. Please do follow the steps explained below:
1, Log into cPanel.
2, Move to “Cron Jobs under Advanced tab”
3, From there you can create the CRON JOB and also add the email account to get the alerts.
Okay all is set! Then why I’m not receiving emails?
The main reason is “the cron job must generate an output to send it via email.” Please try executing the script manually and observe the output. If it isn’t generating any results, please add the following line just before the script ends.
echo "Cron Executed";
If you’ve shell access you can edit the file using your favourite text editor (VI, VIM, NANO etc). Also you can edit the file from the cPanel file manager.
If that doesn’t work please check the CRON and EMAIL logs on the server. Log files locations are listed below:
Cron log : /var/log/cron Email log : /var/log/exim_mainlog