Knowledgebase

Creating and Managing Cron Jobs Print

  • cpanel, cron, php, wordpress, email, wpcron, firewall, resourcelimits
  • 0

A cron job runs a command automatically on a schedule.

CREATING ONE

  1. In cPanel open Cron Jobs under Advanced.
  2. Enter an email address at the top to receive the output, or leave it blank to avoid a flood of messages.
  3. Pick an interval under Common Settings, or set the five fields manually (minute, hour, day, month, weekday).
  4. Enter the command.
  5. Click Add New Cron Job.

COMMON COMMANDS

Run a PHP file:

/usr/local/bin/php -q /home/USERNAME/public_html/script.php >/dev/null 2>&1

Run a WordPress cron (required on our servers, where HTTP wp-cron is blocked):

/usr/local/bin/php -q /home/USERNAME/public_html/wp-cron.php >/dev/null 2>&1

Replace USERNAME with your cPanel username. The >/dev/null 2>&1 part discards output so you are not emailed on every run.

GUIDELINES

Do not schedule anything every minute unless it is genuinely required. Every 5 or 15 minutes is almost always enough, and frequent jobs consume your CPU allowance. Test the command once by hand, or temporarily set an email address, to confirm it works before leaving it unattended. Delete cron jobs for software you have removed. Orphaned jobs generate errors and waste resources.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot