A cron job runs a task on a schedule, for example a script that sends reminders every morning. Your web developer or app instructions will usually tell you the exact command to use.
Creating a Cron Job
- Log in to cPanel (see How to Log In to cPanel)
- In the Advanced section, click Cron Jobs
- Under Add New Cron Job, choose a schedule from Common Settings, for example Once Per Hour
- In Command, enter the command to run, for example:
/usr/local/bin/php /home/cpuser/public_html/cron.php - Click Add New Cron Job
Getting the Results by Email
In Cron Email at the top of the page, enter an email address and click Update Email. You'll get an email each time a job produces output.
To stop the emails for one job, add >/dev/null 2>&1 to the end of its command.
WordPress Cron
WordPress runs scheduled tasks when someone visits your site. On busy or very quiet sites, a real cron job is more reliable:
- Add
define('DISABLE_WP_CRON', true);to wp-config.php - Create a cron job that runs Twice Per Hour with:
/usr/local/bin/php /home/cpuser/public_html/wp-cron.php >/dev/null 2>&1
Replace cpuser with your cPanel username.
Please don't run cron jobs more often than every 5 minutes unless you really need to. Very frequent jobs can slow your site down.