How to set up a cron job in cPanel
Steps last checked on by the Shroti Host team
Short answer
Cron jobs are included on every shared, WordPress and unlimited hosting plan and are set up in cPanel under Cron Jobs. You choose how often the job runs and give the command to run.
Before you start
Shared, WordPress and unlimited plans. You need the full path of the script you want to run.
Steps
Step 1: In cPanel open Cron Jobs.
Step 2: Pick a schedule from Common Settings, such as once per hour, instead of typing the five time fields by hand.
Step 3: Enter the command with full paths. The page shows example commands for running a PHP script.
Step 4: Add the job. To be told when it fails, set the cron email address at the top of the same page.
Step 5: Do not schedule a heavy job more often than it needs. Every run counts toward your account's CPU and process limits.
How to tell it worked
The job is listed on the Cron Jobs page. After the next scheduled time, the script's own result is there (a new file, a sent email, an updated record), and no error email arrives.
If it did not work
- A job that does not run usually has a wrong path, or a script that fails when it runs outside the browser. Set the cron email, wait for the next run and read the error it sends.
- Check that the path starts from your home folder and that the command matches the examples on the page.
- The account hits its limits when the job runs: schedule it less often, or see how to fix the 508 error.
When to contact support
If the job is listed and correct but never fires, open a ticket with the command and the schedule.
We never ask for a password, a card number or an OTP. Do not put one in a ticket or a chat.