How to Check if a Cron Job has Run

A cron job is a time-based task that is set to run at certain intervals from within your cPanel. It sets a particular script to run at a specific time or times on autopilot.

There are different types of cron jobs. Some produce output and others do not. It is easier to determine if the cron ran for those that produce output (a file, email, or webpage output). However, for those that simply perform tasks behind the scene, you will need to tap into the server logs to determine if they have run. Below is a quick tutorial on checking your cron logs to determine if a job has run as it was scheduled.

Don’t have cron jobs setup in Linux yet? Learn how to do so.

NOTE: To perform this function, you will need to have root access on your VPS or Dedicated server.

(For developers or sysadmins experienced with the command line, get High-Availability and Root Access for your application, service, and websites with Cloud VPS Hosting).

Don’t have time to read the article? Watch our walk-through video.

Checking your Cron job via server logs

  1. Open your preferred your SSH client. If you need an SSH client, we recommend PuTTY. You can download PuTTY here.
  2. Login to your server via your SSH client.
  3. Once logged in as the root user, use the following command to check the log for the cron script. The command will use the following format: grep “script.php” /path/file.ext. For instance, the code below is looking for the script cronscript.php in the cron.log file, which is in the /var/log folder.
    grep "cronscript.php" /var/log/cron
  4. Hit Enter after that and the results, if any, will display like below:
    Feb 24 02:33:02 ecbiz108 crond[9772]: (userna5) CMD (php -q /home/userna5/public_html/cronscript.php)
    Feb 25 02:33:01 ecbiz108 crond[16587]: (userna5) CMD (php -q /home/userna5/public_html/cronscript.php)
    Feb 25 11:45:01 ecbiz108 crond[21887]: (userna5) CMD (php -q /home/userna5/public_html/cronscript.php)
  5. Looking at the output, you will see the date and time the cron job has run. This is followed by the server name, cron ID, the cPanel username, and the command that ran. At the end of the command, you will see the name of the script.

Thoughts on “How to Check if a Cron Job has Run

  • Actually i have create one script for dev env. my query was i am given some x value. but script was executed in before timing.
    Anyone why its is running before time.

    • Hello! Just to check, did you confirm that your Development Environment’s time is using the time zone you expect? If you did not configure that yourself, it may be set up to use something automatically that is incorrect. Beyond that, I’d suggest running your CRON script through a tool like crontab and double checking that it works as you want it to. Hope that helps!

    • I recommend you check the logs as indicated in this guide to determine why the cronjob is not running as expected.

      I also recommend you check what user you are using for SSH and what user is running the cronjobs to figure out why crontab is not displaying anything.

      I do apologize, however, I am not able to determine why your cronjob is not working, with the details you have provided.

  • Just a quick tip if you’re looking for a cron job that ran in the past run
    grep “cronscript.php” /var/log/cron-20171008 (which says cron file that is logged at 2017-10-08)

  • i want to find how many jobs are running and on which server  these things i want but didnt get using these commond plz help me. 


    • Hello Sreenu,

      You can see any crons running on the server by checking /var/spool/cron for the given user. And you will see the active crons running in the chosen user’s “crontab”.

    • Hello Kenny,

      If you have a mailto line setup within your crontab then you should get emails from any failing cron jobs.

      Best Regards,
      TJ Edens

Was this article helpful? Let us know!