Knowledgebase

Cron Jobs on Shared Hosting Print

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

A cron job runs a command automatically on a schedule.

CREATING ONE

cPanel > Cron Jobs. Choose an interval, enter the command, and add it. Leave the notification email blank unless you are testing, or you will be emailed on every run.

A TYPICAL PHP COMMAND

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

Replace USERNAME with your cPanel username. The final part discards output.

WORDPRESS ON OUR SERVERS

HTTP requests to /wp-cron.php are blocked across our fleet, because WordPress triggers cron on every page load and this generates enormous unnecessary load. You must set up a real cron job instead:

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

with DISABLE_WP_CRON set to true in wp-config.php. Without this, scheduled posts, auto-updates and backup schedules silently stop.

GUIDELINES

Every 5 or 15 minutes is almost always sufficient. Do not schedule anything every minute without good reason, as frequent jobs consume your CPU allowance. Test the command once before leaving it unattended. Delete cron jobs for software you have removed.


Was this answer helpful?
Back

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


Trustpilot