scion(host

Knowledge base

Cron jobs: what are they, and how to use them

Knowledge base

Under UNIX, Periodic execution is handled by the cron daemon. Individual tasks to be executed are commonly referred to as cron jobs, and are stored in a single file called a crontab.

Each crontab has the same format:

minute hour day month weekday command

Whether within Cpanel or directly in the file, each crontab will have the above format, and each field can contain:

Examples:

50 11 * * 1-5
Means 11:50am, Monday through Friday.
55 15 * * 0-3,6
Means every day except Thursday and Fridays at 3:55 p.m.

One of the most common uses for cron jobs will be to execute a PHP file on a periodic schedule, the best way to do this is:

php -q /home/username/public_html/path/to/script > /dev/null
lynx -dump http://site.com/fil.e.php > /dev/null

The above two commands will execute the php script.

Cpanel allows for a e-mail address to be entered, if you would like to receive the output from the commands; you should enter your e-mail address, however it’s not neccessary.

Categories

Getting started:

Cpanel control panel:

Webhost manager (WHM):

Questions and tips:

E-mail:

Domains and DNS:

FTP and files:

Htaccess magic:

CGI, PHP and Perl:

Subdomains:

SSL:

xhtml  css