Site Cron and Scheduled Tasks

Who this is for

Users who need to run scheduled tasks for their site — for example, WordPress's WP-Cron, database cleanup jobs, cache warming scripts, or custom PHP/shell scripts.


Prerequisites

  • Site is running with SSH connectivity.
  • Site app type supports cron (WordPress and Custom app types). Static sites do not have cron.

What Site Cron Does

The Cron tab on the site detail lets you manage the crontab entries for the site. Cron jobs run as the cloudpilot user on a schedule you define using standard cron syntax.


Cron Schedule Syntax

Cron jobs use 5-field syntax:

* * * * *  command
│ │ │ │ │
│ │ │ │ └── Day of week (0–7, where 0 and 7 = Sunday)
│ │ │ └──── Month (1–12)
│ │ └────── Day of month (1–31)
│ └──────── Hour (0–23)
└────────── Minute (0–59)

Common examples:

ScheduleMeaning
*/5 * * * *Every 5 minutes
0 * * * *Every hour at :00
0 2 * * *Every day at 2:00 AM
0 2 * * 0Every Sunday at 2:00 AM
0 0 1 * *First day of every month at midnight

How to Add a Cron Job

  1. Open the site detail → Cron tab.
  2. Click + Add Cron Job.
  3. Fill in:
  • Schedule: cron expression (e.g., */15 * * * *)
  • Command: the shell command to run (e.g., php /var/www/myblog/wp-cron.php)
  1. Click Save.

CloudAIPilot writes the entry to the cloudpilot user's crontab on the server.


WordPress WP-Cron Setup

By default, WordPress uses a virtual cron that runs when users visit the site. For more reliable scheduling (especially on low-traffic sites), disable the built-in WP-Cron and use a real cron job:

  1. Add define('DISABLE_WP_CRON', true); to wp-config.php via the File Manager.
  2. Add a cron job with the schedule */15 * * * * and command:
   php /var/www/[your-site-docroot]/wp-cron.php > /dev/null 2>&1

How to Edit or Delete a Cron Job

  1. In the Cron tab, find the job.
  2. Click Edit to modify the schedule or command.
  3. Click Delete (trash icon) to remove it.

Changes take effect immediately — CloudAIPilot updates the server's crontab in real time.


What Success Looks Like

The cron job appears in the list. The server's crontab is updated. For WP-Cron, WordPress events (scheduled posts, email notifications) run reliably on schedule.


Common Issues and Fixes

IssueLikely causeFix
Cron tab not availableSite is a Static typeStatic sites don't support cron. Use a Custom app type if you need cron.
Cron job runs but command failsWrong path or missing executableTest the command manually in the server Terminal tab.
Output or errors from cron jobCron output goes to server mailRedirect output: append > /dev/null 2>&1 to silence, or >> /var/log/my-cron.log 2>&1 to log it.
WP-Cron still not runningDISABLE_WP_CRON not setVerify wp-config.php has define('DISABLE_WP_CRON', true);

Related Articles