This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Cron Job Basics

Summary

This article will provide an overview of what Cron Jobs are. If you are unfamiliar with Cron Jobs, please read this carefully as Cron Jobs are a more advanced feature of your account. If you are familiar with Cron Jobs and simply want instructions on using Cron Jobs, please refer to this list of Cron Job articles:


What is a Cron Job?

A Cron Job is a Linux command for scheduling a task (command). Cron Jobs allow you to automate certain commands or scripts on your server to complete repetitive tasks automatically.

This can be a very resourceful tool as a Cron Job can be set to run by 15 minute or hourly increments, a day of the week or month, or any combination of these. Just Host limits Cron Jobs on shared servers to run in increments no less than every 15 minutes as excessive Cron Jobs can cause unnecessary loads on the server.

For example, you could set a Cron Job to delete temporary files every week so that your disk space is not being used up by unnecessary files. Some scripts, such as Drupal, may even require you to set up a Cron Job to perform certain functions.

WARNING! It is important that you familiarize yourself with how Cron Jobs work. You need to have a good knowledge of Linux commands before you can use Cron Jobs effectively.

Check your script with your hosting administrator before adding a Cron Job.

For most Cron Jobs, there are three components present:

  1. The script that is to be called or executed.
  2. The command that executes the script on a reoccurring basis. This is typically set in the cPanel.
  3. The action or output of the script, which depends on what the script being called does. Frequently, scripts called as a Cron Job modify files or databases, however they can perform other tasks that do not modify data on the server, like sending out email notifications.
Most scripts that require the use of a Cron Job will give you specific instructions on what needs to be setup, frequently giving examples.

Cron Job Environment

  • The initial working directory for the process is your home directory.
  • Because the processes are run in a non-interactive shell, .bashrc and other startup files are not read.
  • Only /usr/bin and /bin will be checked for the specified executable. Executables in other directories must be specified as absolute paths, such as /ramdisk/bin/php5 or relative paths, such as ./my_program.
  • When running a script, the interpreter must be specified either in a valid #! line using a full path or at the command line.
  • File arguments must be specified with absolute paths, or paths relative to the current working directory.

For additional information on Cron Jobs, use the following resources:

http://en.wikipedia.org/wiki/Cron (Basic)
http://www.unixgeeks.org/security/newbie/unix/cron-1.html (Advanced)

Video "How-to" Tutorial 338,695 views bookmark tags: cpanelutilities cron


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How do I upload my web site?
Knowledgebase Article 1,799,106 views tags: ftp site upload uploading web website

How to run cron jobs at a specific "local" date and time.
Knowledgebase Article 164,092 views tags: cron time

Script executed with a cron job requires a specific php.ini file to be used.
Knowledgebase Article 215,740 views tags: command cron cronjob crontab custom line optimizer php zend

Related Help Content

How do I publish my Web site using Publisher?
Knowledgebase Article 264,153 views tags: ftp microsoft publisher publishing site web

This article will explain how to setup, remove, or edit a Cron Job.
Knowledgebase Article 365,643 views tags: cron crontab job

This article will explain how to run php and other file types using Cron jobs.
Knowledgebase Article 511,468 views tags: cron file jobs php

Redirects allow you to make a specific web page redirect to another page and display the contents of that page. Learn how to setup a Permanent (301 or Termporary (302) redirects.
Video "How-to" Tutorial 580,859 views tags: cpanel cpanelutilities domain forward redirect

How to backup all of your MySQL databases using the Site Backup & Restore tool
Knowledgebase Article 250,011 views tags: backup database mysql restore site

How to restore MySQL databases using the Site Backup & Restore tool
Knowledgebase Article 238,159 views tags: backup database mysql restore site

This article will explain how to connect your scripts to your MySQL databases.
Knowledgebase Article 225,361 views tags: database mysql scripts

How to restore Email Messages the Site Backup Pro tool
Knowledgebase Article 242,961 views tags: backup email forwarders restore site

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.