Home Guides Glossary

What is a Cron Job?

Cron is a standard Linux feature that allows you to schedule tasks, called "Cron Jobs," to run unattended at a specified frequency. For example, you can set the frequency of a job to run twice an hour, Mondays at 8:00 a.m., or weekdays at 12:00 p.m. and 6:00 p.m.

Cron Job reports are sent to the email address specified in the Hosting Control Panel Cron Job Manager.

There are several ways to schedule commands to run. Typically, you create a shell script to run as a Cron Job. It runs a list of commands while checking for errors and valid return codes. To run a shell script, set its bit set permissions to "executable." Alternatively, compose a binary executable with a number of arguments. For example, "touch" a file:

/bin/touch $HOME/html/cron_test

The first part of this sample command, "/bin/touch" runs the executable. The second part, "$HOME/html/cron_test" is an argument for the "touch" command.

NOTE: In the example above, the "$HOME" variable is set to the default directory of the hosting account. The "html" directory is the document root of the hosting account.

In addition to shell scripts, your hosting environment supports other language scripts. For example, Perl is a commonly used scripting language that can use scripts as Cron Jobs. In most cases, you can perform this task by specifying to use the executable as the first line of the script. For example:

#!/usr/bin/perl

When a script begins with a line, as in the previous example, and the executable permissions are set, you can specify the line as the command to run for a Cron Job.

The PHP (versions 4 and 5) hosting installations do not support the use of the executable line in scripts. To run a PHP script with Cron, you must set the path to the PHP interpreter as the first element of the command, and then enter the full path of the script you want to run.

The full path to the PHP executables depend on what type of hosting you have (more info) and your PHP version (more info):

Hosting type PHP version Path
cPanel 5.5 /usr/bin/php
cPanel 5.4 /usr/local/bin/php
Plesk 5.4 /web/cgi-bin/php5_4
Web & Classic 5.3 /web/cgi-bin/php5_3
Web & Classic 5.0-5.2 /web/cgi-bin/php5
Web & Classic 4 /web/cgi-bin/php

Our Classic & Web hosting accounts using PHP version 5.4 do not currently support running PHP scripts with Cron.

For more information, see Create Cron jobs.

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

For as little as $3.89 per month you can build your Website online with Website Builder using our easy to use professional templates. Play Video - Demo

Quick Shopping Cart

Build and run your own successful online store in minutes. You're just five easy steps away! Shopping Cart works with Google® and eBay® Play Video

Website Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate

Copyright © 2005 - 2017. All rights reserved. Privacy Policy