How to set up a cron job

A cron job runs a script automatically on a schedule — handy for WordPress tasks, imports, clean-ups or any recurring job.

Create a cron job

  1. Sign in to CHPanel and open the Cron tab (also under Advanced → Cron Jobs on the Home page).
  2. Under Add cron job, pick how often it should run from the Common settings dropdown (for example once a day or hourly). This fills in the Schedule as a cron expression such as 0 2 * * * (2 am every day). You can edit it by hand if you know cron syntax.
  3. Enter the Command to run.
  4. Click Add cron job.

Adding a cron job in CHPanel

Your job appears in the list with its schedule, command and status. To stop it, click Delete on that row.

Common commands

To run a PHP script in your site: php /home/yourusername/public_html/cron/nightly.php — replace yourusername with your account username (shown as Current User on the Home page) and the path with your script. For a WordPress cron, your plugin or developer will give you the exact command.

Tips

  • Do not schedule jobs more often than you need — every minute is rarely necessary and slows your site.
  • Make sure the script works before you schedule it, so you are not running a broken job every night.
  • Unsure of the command? Open a support ticket and we will help.

Was this answer helpful?

 Print this Article

Also Read

How to use the CHPanel File Manager

File Manager in CHPanel lets you upload, edit and organise your website files right from your...

How to create a MySQL database in CHPanel

Many website apps (including WordPress) need a MySQL database. CHPanel's Database Wizard creates...

How backups work in CHPanel (and how to restore)

CHPanel backs up your account automatically every night, so you can roll back if something goes...

How to log in to CHPanel

CHPanel is your hosting control panel — it is where you manage files, email, databases, domains...

A tour of your CHPanel home page

CHPanel puts every hosting tool on one screen. Here is a quick tour of the Home page so you know...