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

How To Install and Uninstall FrontPage Extensions

This tutorial will show you how to install and uninstall FrontPage extensions. Please note that...

Bash output redirection

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

Mod PageSpeed

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

How To Set Up A Cron Job via CPanel

This tutorial is going to show you how to setup a cron job in cPanel the easy way. You can set a...