Knowledgebase

Working with Cron Jobs as a Developer Print

  • developersgitdeployment, developers, cron, wordpress, php, wpcron, cpanel, backup, firewall, plugins
  • 0

Scheduled tasks on hosting.

CREATING ONE

cPanel > Cron Jobs. Set the interval and the command.

Use the full path to the PHP binary and to your script.

THE WORDPRESS POINT

HTTP requests to /wp-cron.php are blocked on our servers, because WordPress triggers cron on page loads and generates enormous unnecessary load.

Set DISABLE_WP_CRON to true in wp-config.php and create a real cron job calling wp-cron.php with the PHP binary, or run the WP-CLI cron command.

Without this, scheduled posts, updates, backups and any plugin relying on cron silently stop.

FOR FRAMEWORKS

Laravel's scheduler expects one cron entry running its scheduler every minute, which then dispatches the tasks you defined.

Check your framework's documented arrangement rather than scheduling each task separately.

GOOD PRACTICE

Redirect output to a log rather than discarding it, at least while testing Use full paths Test the command manually before scheduling Avoid every-minute schedules unless genuinely needed, since frequent jobs consume your CPU allowance

VERIFYING

Check the log, and check the effect.


Was this answer helpful?
Back

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


Trustpilot