UnixServerAdmin

Server Administration & Management

How to set Cron Job in cPanel

Standard Method :-

1. At the bottom of the cPanel interface, locate and click the “Cron Jobs” icon.
2. Click on the “Standard” tab.
3. The first option calls for you to enter the email address of where you want the results of the
cron job to be sent. Simply enter the email address in the provided field and move onto the next step.
4. For “Entry 1? you will see the text “Command to run” with a text box beside. Input the command or path to the script you want to run in the field.

Example :- php -q /home/username/public_html/cron.php

-a               Run interactively
-b              <address:port>|<port> Bind Path for external FASTCGI Server mode
-C               Do not chdir to the script’s directory
-c               <path>|<file> Look for php.ini file in this directory
-n               No php.ini file will be used
-d               foo[=bar]     Define INI entry foo with value ‘bar’
-e               Generate extended information for debugger/profiler
-f                 <file>        Parse <file>.  Implies `-q’
-h               This help
-i                PHP information
-l                Syntax check only (lint)
-m             Show compiled in modules
-q              Quiet-mode.  Suppress HTTP Header output.
-s               Display colour syntax highlighted source.
-v              Version number
-w              Display source with stripped comments and whitespace.
-z <file>  Load Zend extension <file>.

5. Below “Command to run”, there are five options that will allow you the set the time and intervals for your cron job. Those options are listed as follows:
Minute(s)
Hour(s)
Day(s)
Month(s)
Weekday(s)
Once you create the Cron job, a confirmation page will be displayed stating “Cron Updated”.

6. After making the appropriate selections, click the “Save Crontab” button to create the entry. If you elect to reset the changes and go back to the default settings, simply click the “Reset Changes” button.
7. Click the “Go Back” tab and you will be redirected back to the main Cron Job screen.
8. Check your email address to view the results of the cron job.

Advanced Method :-

1. From the main Cron Job screen, click the “Advanced (Unix Style) tab.
2. The first option calls for you to enter the email address of where you want the cron job results to be sent. Simply enter the email address in the provided text box.
3. From there, enter the Minute(s), Hour(s), Day(s), Month(s) Weekday and Command in the provided text boxes.
4. Next, click the “Save Crontab” button to create the entry. If want to the reset the changes and revert back to the default settings, simply click the “Reset Changes” button.
5. A confirmation page will be displayed stating “Cron Updated!” Click the “Go Back” button and you will be redirected back to the main Cron Job screen.
6.) Check your email address to view the results of the cron job.

If you want to benefit from cron jobs and use them effectively, you will need to have some familiarity with Linux commands. This is especially true when creating cron jobs in the Advanced Unix variation. For this reason, it is recommended to inquire within your web host about the files and scripts you want to run before executing them.

Advertisements

March 3, 2011 - Posted by | cPanel, Cron | , ,

1 Comment »

  1. Wonderful goods from you, man. I’ve understand your stuff previous to and you are just extremely excellent. I really like what you’ve acquired here, really like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it wise. I cant wait to read far more from you. This is actually a wonderful web site.

    Comment by Dusty Girt | October 21, 2011 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: