[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”

cronemail1

3, From there you can create the CRON JOB and also add the email account to get the alerts.

cronemail2

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

That’s it!

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

2 thoughts on “[Solved] Why my cronjob not emailing me after it’s done?

Leave a Reply

Your email address will not be published. Required fields are marked *