Cron Job Test

Here's a couple steps that will help you to quickly determine whether your Cron Jobs are actually running.

  1. Create a blank text document named cron-test.txt and upload it into a test folder. Change the Permission settings on the folder to 777 or Full Permissions for the Everyone User. (Changing Permissions in the WebControlCenter) (Changing Permissions in cPanel File Manager) (Changing Permission in PLESK)
  2. Create a file named cron-test.php with the following code in the same folder:
    <?php
    $crontext = "Cron Run at ".date("r")." by ".$_SERVER['USER']."\n" ;
    $folder = substr($_SERVER['SCRIPT_FILENAME'],0,strrpos($_SERVER['SCRIPT_FILENAME'],"/")+1);
    $filename = $folder."cron-test.txt" ;
    $fp = fopen($filename,"a") or die("Open error!");
    fwrite($fp, $crontext) or die("Write error!");
    fclose($fp);
    echo "Wrote to ".$filename."\n\n" ;
    ?>
    
  3. Finally, return to Cron Job feature in the control panel and create the following Cron Job:
    * * * * * php /yourfolder/cron-test.php
    
  4. Wait a couple minutes and then open up cron-test.txt and see what's there.

Add Feedback