Schedule tasks with cron jobs
A cron job runs a task for your website on a schedule: sending a newsletter queue every hour, clearing old files every night, or running a script your software tells you to schedule.
Add a cron job
Section titled “Add a cron job”-
Sign in to the control panel, open Websites and select the website.
-
Select Advanced in the website’s navigation bar, then Developer tools, and scroll to Cron jobs.
-
Select Add.
-
Choose the Cron type marker 1:
- Run command runs a command on the server, such as
php ~/public_html/cron.php.~is the website’s home folder. - Request URL visits an address, such as
https://example.com/cron, as if someone had opened it in a browser.
- Run command runs a command on the server, such as
-
Enter the Command or Request URL marker 2, exactly as your software’s instructions give it.
-
Choose the Interval marker 3: Every minute, Every 15 minutes, Every hour, Every day, Every week, Every month, or Custom to enter your own schedule in cron format.
-
Select Add marker 4.
The job appears in the Cron jobs list with its command and interval. The menu button (three dots) at the end of its row has Edit and Delete.
WordPress
Section titled “WordPress”WordPress normally runs its scheduled tasks, such as publishing scheduled posts, only when someone visits the site. WordPress installed from the control panel also gets a cron job that runs WordPress’s due tasks once an hour, so they happen even on quiet sites. You will see it in the list; leave it in place.
Allow editing of cron from website container
Section titled “Allow editing of cron from website container”Below the list, Allow editing of cron from website container lets scripts on your website, and you over SSH, change the website’s cron jobs with the crontab command. It is off by default because malware often uses cron to reinstall itself. Leave it off unless your software specifically needs it, and manage cron jobs in the control panel instead.