Crontab

From Email Marketing Wiki
Jump to: navigation, search
Cron.gif
Cron jobs is an option in cPanel that allows you to schedule tasks to be run periodically, for example to automatically backup your database or other files on a regular basis. Cron jobs are stored on the server in a file called crontab that specifies the shell commands to be run, and when they should be run. The word cron is derived from command run on.

Be very careful when creating a cron job - if you don't know what you are doing, it is very easy to overburden the server which may result in your hosting account being suspended!

cron jobs in cPanel

NOTE: The cPanel interface for cron jobs has changed since this article was written, but the procedure is mostly the same.

When you select "Cron jobs" in cPanel you will be given the option of "Standard" or "Advanced" (Unix Style). The easiest method is obviously standard, but if you have worked with cron jobs in Unix previously there should be little problem using it here.

Cronscreen.gif

You will need to know the command to run, which you type into the appropriate box labeled Command to run:

You then select how regularly you want the cron jon run. The jobs can be run as regularly as every minute (definitely not advisable on shared hosting) to once a year.

The scheduling options are quite powerful. For example, you could run a job twice every Tuesday and Thursday, at 6:15am and 11:15pm by selecting:

Minute(s)   15
Hour(s)     6 23
Month(s)    Every month
Day(s)      Every day
Weekday(s)  Tuesday + Thursday

Select both Tuesday and Thursday in the list of week days using Ctrl-click (Windows).

Advanced cron

The scheduling options for cron can be even more powerful. For example you could schedule a job to run hourly during the day and every two hours during the night, or at a specific time on Tuesday, Thursday and Friday every week. For more details see external links below.

See also

External links

Template:CPanel Advanced