Skip to content

Cron job is not running

Work out whether an Avaloi cron job or WP-Cron is late, check the pause switch and the last run, and fix the schedule or the command.

Avaloi cron jobs run on the server on the schedule you set, on the Cron tab of the site. They are separate from WP-Cron, the scheduler inside WordPress that runs when someone loads a page. Knowing which one you rely on is the first step.

What you see

  • A job's last run is older than its schedule, or the row shows no run at all.
  • Scheduled posts, reminder emails, or plugin tasks in WordPress happen late or not at all.
  • Add cron job refuses the schedule you typed.
  • The job runs, but it does not do what you expected.

Check these first

  1. Decide which cron you mean. WordPress tasks (scheduled posts, plugin cleanups, emails) run through WP-Cron, which only runs when a visitor loads a page. On a quiet site, they wait. An Avaloi cron job runs on time whether or not anyone visits, so the fix for late WordPress tasks is an Avaloi cron job that runs WP-Cron, for example wp cron event run --due-now, every 5 minutes.
  2. Check the pause switch. Open the site, then Cron. A paused job shows its switch off and never runs until you turn it back on. Pause and resume from the switch or the row's menu, or call PATCH /v1/environments/{id}/cron/{cron_id}.
  3. Open the last run. Open the row to see the exit code, the output, and when Avaloi removes it. An exit code other than zero means the command failed, and the output says why. Avaloi keeps the output for 7 days. If there is no run to show, the job has not run in the last 7 days, or never has.
  4. Check the schedule. A job runs at most once every 5 minutes. A faster schedule is refused when you save it, with an explanation, and the API returns 422. If you used the cron expression field, read the five fields again: a job set to run on one day of the month looks idle for weeks.
  5. Check the environment. Each environment has its own cron jobs. Use the environment switcher at the top of the site to make sure you are looking at live and not staging, or the other way round. A job you added while staging was selected does not run on live.
  6. Read error.log. Open Logs and pick error.log, then look at the minutes around the scheduled time. A PHP fatal error from the command shows there even when the cron output is short.

Fix it

  • If the job is paused, turn the switch on.
  • If the exit code is not zero, fix the command. For a WP-CLI command, run it under Tools, WP-CLI, without the wp prefix, to see the result right away. The same allowlist applies in both places, so a command refused there is refused in cron too.
  • If the schedule was refused, pick every 5 minutes or slower in the schedule builder, or correct the cron expression.
  • If the job is on the wrong environment, add it again on the right one and delete the old one. Deleting asks you to type the job's description.
  • If WordPress tasks are late and no Avaloi cron job runs WP-Cron, add one as described in step 1.

Still stuck

Write to [email protected] with the site name, the environment, the request ID from the API response or the job ID, and what you tried. Add the cron job's description, its schedule, and the exit code and output of the last run.

Still stuck?

Email [email protected] with your site name and what you tried, or send us a message.