How do I configure a cron job ?

Cron jobs are commands used to schedule tasks that must run periodically, for instance: from Monday to Friday at 6PM. These jobs allow you to automate some commands and scripts on your server, to automatically run repetitive tasks. For instance, you could create a cron job to send emails every 7 days.

1. Login to cPanel.
2. Locate and click on the "Cron Jobs" icon under the "Advanced" category.
3. Fill in the required information.

    Common Settings - You can use this dropdown list to populate all but the last fields.
    Minute - The minute setting for the cron job.
    Hour - The hour setting for the cron job.
    Day - The day setting for the cron job.
    Month - The month setting for the cron job.
    Weekday - The weekday setting for the cron job.
    Command - The cron job command to execute.

If you wanted to execute a script, the command would look similar to this:
/usr/bin/php ~/public_html/cron.php >/dev/null 2>&1

If you want to avoid overlaping, please use the following format:
/usr/bin/flock -n ~/public_html/var/locks/sync.lock /usr/bin/php ~/public_html/shell/script.php >/dev/null 2>&1




  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

GeoIP

How to get mod_geoip to work on cPanel (Country and City)   mod_geoip allows you to look...

Mod PageSpeed

You can install Mod PageSpeed by using following stepswget...

Bash output redirection

There are 3 built-in file descriptors: stdin, stdout and stderr (std=standard).Basic    0/1/2...

Using Index Manager

This tutorial will teach about using the Index Manager. The Index Manager allows you to customize...