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




  • 101 Users Found This Useful
Was this answer helpful?

Related Articles

How to create custom error pages

This tutorial will teach how to create custom Error Pages. Create error pages for 404 Not Found...

Mod PageSpeed

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

How To Install and Uninstall FrontPage Extensions

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

GeoIP

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

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...