Difference between revisions of "Cron Jobs"

From Hostek.com Wiki
Jump to: navigation, search
Line 16: Line 16:
  
 
==WCP/Windows - Setting up Cron Jobs==
 
==WCP/Windows - Setting up Cron Jobs==
#This option is currently not available within our Windows plans, which utilize WCP (MochaPanel).  
+
#With a recent update to Windows Control Panel (WCP) we've added Windows cron jobs. To make use of these, login to WCP and find the Cron Jobs tool (clock icon). It'll be on the bottom of the panel. To set up a cron on Windows:
#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.
+
##Click Add
 +
##Choose a name for the Cron
 +
##Place a URL to be executed
 +
##If this is a simple cron, keep the Easy mode selected. Advanced gives you complete control over when your cron runs.
 +
##Choose the interval at which the cron runs
 +
##Click Save
  
 
==Common Cron Failures==
 
==Common Cron Failures==

Revision as of 17:25, 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. With a recent update to Windows Control Panel (WCP) we've added Windows cron jobs. To make use of these, login to WCP and find the Cron Jobs tool (clock icon). It'll be on the bottom of the panel. To set up a cron on Windows:
    1. Click Add
    2. Choose a name for the Cron
    3. Place a URL to be executed
    4. If this is a simple cron, keep the Easy mode selected. Advanced gives you complete control over when your cron runs.
    5. Choose the interval at which the cron runs
    6. Click Save

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.