Difference between revisions of "Cron Jobs"

From Hostek.com Wiki
Jump to: navigation, search
Line 18: Line 18:
 
#This option is currently not available within our Windows plans, which utilize WCP (MochaPanel).  
 
#This option is currently not available within our Windows plans, which utilize WCP (MochaPanel).  
 
#Alternatively, if you have need of a Cron Job: please submit a ticket to our support team (here: [http://support.hostek.com/ Support]) or send an email to '''support@hostek.com''' with the '''Frequency''' and the '''URL''' of the Task and we'll see if we can't get that added for you.
 
#Alternatively, if you have need of a Cron Job: please submit a ticket to our support team (here: [http://support.hostek.com/ Support]) or send an email to '''support@hostek.com''' with the '''Frequency''' and the '''URL''' of the Task and we'll see if we can't get that added for you.
 +
 +
==Common Cron Failures==
 +
*Not Firing: When You Specified Make sure your time format is correct. Sometimes extra zeroes or an extra asterisk (*) makes their way into the mix. This will cause the cron to fire at the wrong time, or a complete failure.
 +
 +
*Long Wait Times: If your script has long processes it handles and you've manually changed the timeout time in the configurations, this may not be passed to the cron. See if you can shorten the processing time. If you need to try and lengthen the timeout time on the cron, send an email to support@hostek.com with the details of your cron job.
 +
 +
*Multiple Firings: Most time when you see multiple firings it's actually that the cron is executing an initial part of the script, failing somewhere after that, and trying again. Try setting up a flag, most usually a simple email, at the very end of the code to determine if this is what's causing the double firings.
 +
 +
*No Firings: If your cron is not failing at all, you may need to look at the logs as to why. To do this, send an email to support@hostek.com. However, the most common reasons for why a cron wouldn't fire at all are below.
 +
 +
**Missing/invalid script path: If you need the script at D:\home\domain.com\wwwroot\myscript.php to fire, but you say it's at D:\home\domain.com\myscript.php then nothing will fire.
 +
**Bad URL: Most crons need to have HTTP:// in front of the URL path. Make sure to check the URL you're using.

Revision as of 17:18, 21 January 2015


cPanel/Linux - Setting up Cron Jobs

  1. Please keep in mind that you may have to have a cron job be executed by a specific service.
  2. For Example a PHP File to be run:
/usr/bin/php -q /home/user/public_html/cron.php
  1. If you do not want the email to be received for confirmation you will need to add the following to the end of your request:
/usr/bin/php -q /home/user/public_html/cron.php > /dev/null
  1. If you are using get for a http request it would be like this:
/usr/bin/curl --silent --output /dev/null http://yourdomain.com/cron.php

WCP/Windows - Setting up Cron Jobs

  1. This option is currently not available within our Windows plans, which utilize WCP (MochaPanel).
  2. Alternatively, if you have need of a Cron Job: please submit a ticket to our support team (here: Support) or send an email to support@hostek.com with the Frequency and the URL of the Task and we'll see if we can't get that added for you.

Common Cron Failures

  • Not Firing: When You Specified Make sure your time format is correct. Sometimes extra zeroes or an extra asterisk (*) makes their way into the mix. This will cause the cron to fire at the wrong time, or a complete failure.
  • Long Wait Times: If your script has long processes it handles and you've manually changed the timeout time in the configurations, this may not be passed to the cron. See if you can shorten the processing time. If you need to try and lengthen the timeout time on the cron, send an email to support@hostek.com with the details of your cron job.
  • Multiple Firings: Most time when you see multiple firings it's actually that the cron is executing an initial part of the script, failing somewhere after that, and trying again. Try setting up a flag, most usually a simple email, at the very end of the code to determine if this is what's causing the double firings.
  • No Firings: If your cron is not failing at all, you may need to look at the logs as to why. To do this, send an email to support@hostek.com. However, the most common reasons for why a cron wouldn't fire at all are below.
    • Missing/invalid script path: If you need the script at D:\home\domain.com\wwwroot\myscript.php to fire, but you say it's at D:\home\domain.com\myscript.php then nothing will fire.
    • Bad URL: Most crons need to have HTTP:// in front of the URL path. Make sure to check the URL you're using.