20
years
CalendarScripts.info
Providing Reliable Software Since 2004
All products are instantly delivered after purchase.

All sales include:

  • 1 year free support
  • 1 year free upgrades
  • Open source code

How To Set Up Cron Jobs In Cpanel

A quick and short guide that even a newbie can understand

Some of the scripts you want to install on your host (for example Arigato PRO Autoresponder) will require you to set up a cron job. This is a command that runs automatically at specified period of time - once per day, once per hour, each 5 minutes, each Monday etc.

Setting Up a Cron Job With Cpanel Is Easy

Fortunately most shared web hosts are running Cpanel which makes setting up a cron job a very easy task. It's not going to take you more than 5 minutes. We'll cover using the "Standard" procedure, because it's easier to understand and follow.

Enter the Cpanel control panel of your website (usually by loading http://yourdomain.com/cpanel in the browser) and locate the "Cron Jobs" icon. If you can't see it immediately, press Control+F and type "cron". Your browser will locate the icon for you. Click on it and see the following screen:

Setting a cron job - step 1

Click on "Standard" button to load the standard Cpanel cron job interface:

Setting a cron job - step 2

There are just four little things you have to do and I have numbered them on the screenshot:

1. Enter email which to receive the cron job output (optional). This step is completely optional - in most cases you will not really care to receive email each time when the scheduled script runs.

2. Enter the command to run.

Arigato PRO Users: you don't need to manually construct the command as in the examples below. Simply copy it from your Arigato PRO -> Help page, section "Cron Jobs". Try with the first command and if it doesn't work, use the second.

Important: On many Cpanel based servers instead of the command shown below you can simply enter command like this:

GET http://yourdomain.com/sender.php

This command will work for scripts that allow running from the web. Of course replace "http://yourdomain.com/sender.php" with the URL of your script, as you would access it from the browser. You can just go ahead and try. If it works for you you can jump to step 3 ("Schedule when the command should run").

Most often you will be running a PHP or other script like in the example I have given. Let's dissect this example command in several parts:


Example command: php -q /home/pimteam/public_html/sender.php > /dev/null

  • php -q is the actual command telling the server that you are going to run a PHP script.
  • /home/pimteam/public_html/sender.php is the path to the script that needs to be run. Here is why you need to know your account username. Most shared hosts using Cpanel place your content under the home directory. (Note the slash at the beginning! This means absolute path.) Then your account username follows as a folder. Then 99% chance is you are placing your scripts under the public_html directory. Then follows the path to your PHP script, in this example sender.php
  • > dev/null tells the server that the cron job outut must be sent to the data sink so it does not bother your server logs or email. If you prefer to receive the cron job output, you can omit this part.

3. Schedule when the command should run. The options providedby Cpanel here are easy to understand. You can schedule the command to run in specific days or every day, every month or just some month, at specific hour(s) and minute(s) or just at 3.30 AM for example. You can select several options from each selection box by holding the Control key.

4. Save Crontab. Hit this button to save your changes. That's it :)

What if your site control panel looks different?

Most probably your hosting doesn't use Cpanel, but some other software. It's also possible that you have opened some other admin panel of your site but not the hosting control panel. In both cases you can first search for information about setting up cron jobs in the help files given by your hosting provider. You can also directly contact the support and ask for help.

In the event you have to deal with some different web hosting control panel like Plesk or Webmin or you have to use Shell console, I recommend you checking the following tutorials:

If you are still confused, just follow me on Twitter and ask your questions!