Many of our account holders use cron jobs to perform tasks at specific times. These jobs run at schedulee intervals set within the cron job tool in the cPanel. One of the features of this tool allows you to set an email address so that you receive an email every time the cron job runs. This allows you to keep track of your cron jobs and ensure they are running correctly and as scheduled. However, sometimes we receive support questions that some cron jobs are running but the email is not being recieved. Follow below as we explain how to ensure you get an email for every cron job.

Force an email after cron job is run

  1. Log into your cPanel.
  2. From within the main cpanel area, scroll down and find the Advanced category. Click on the cronjobs icon found in that category.
  3. Now you are in the cron job setup screen. At the top is a Cron Email area where you can enter the email address you want to receive notice every time a cron job runs. Enter your email address here if you do not see an email address next to Current email:
    cron notification email setting
  4. If you already have an email address in that section and are not receiving an email for one of more of your cron jobs, this is because that the job in question is not producing output. We want to force some sort of output, so from the cron job screen, look at the path of the cron job in question so you know where the script lives. Write down the path if necessary.
    path to cron job
  5. Now that we know where the script is, go back to the main cPanel page and open up the File Manager from within the Files category.
  6. Once in the File Manager, navigate to your cron script. In our sample, it is simply under the public_html folder and is named testcron.php> Locate your file and highlight it, then click on the Edit icon found in the upper toolbar of the screen. Another popup will appear, simply click on the Edit button there as well to continue to the editor.
    edit cdon script dile
  7. Now that you are in the editor, we want to add a single line to ensure some output is produced. This can be anything from as simple as a space to a sentence. Below is the code we will add to the end of our script:
    echo "done";
    Be sure the line of code is before the php closing tag of ?>.
  8. Click on the Save Changes button at the top of the screen. Your cron job should now email you every time it runs with the single line of output.
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!