Skip to main content

Task Scheduler

Task Scheduler edits your account's crontab: the standard Unix crontab, as text, with syntax help and examples around the editor.

  • A job runs as your account's system user, in your home directory.
  • On save, the panel validates the file, reports the exact line of any error, and installs nothing until it's valid.
  • The first time you open the editor, it gives you a commented template that covers everything below.
Most cron problems come from the environment, not the schedule

A cron job gets a minimal environment, not your login shell's.

The template solves this by declaring what you need at the top:

SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=

*/30 * * * * cd ~/public/example.com && wsudo php wp-cron.php

Three rules that prevent the classic failures​

1. "It works in the terminal and fails in cron" is almost always PATH. Set PATH in the crontab or use full binary paths; Runtimes & Tools gives the exact path for a specific version.

2. Cron emails each job's output to your account's System Mailbox, read from the panel. A job that prints a lot on a frequent schedule fills it; the panel also clears it after 30 days.

What you wantWhat to write
No mail at allMAILTO=, with nothing after it
A log>> ~/log/cron.log 2>&1 on the job
No output at all> /dev/null 2>&1 on the job
tip

The panel has no view of the last run, so a log file is also how you see what happened.

3. Times are server time until you say otherwise. Set CRON_TZ=Europe/Berlin to schedule in your own time zone, and TZ= as well if the program must also see that zone.

A job that acts as the web user​

A job that maintains a website's files, e.g. WordPress's cron or a framework's scheduler, must usually run as the web user, so the files it writes stay writable for the web application. Put wsudo in front of the command:

*/30 * * * * cd ~/public/example.com && wsudo php wp-cron.php
0 * * * * cd ~/myapp && wsudo php artisan schedule:run
For WordPress, also turn off the built-in cron

Add define('DISABLE_WP_CRON', true); to wp-config.php. The built-in version runs when a visitor opens a page: unreliable on a quiet site, wasteful on a busy one. A real cron entry is neither.

note

You have the full power of cron: every minute, a specific weekday, a specific month. A job counts as an ordinary process of yours: it shows in Processes while it runs, and your account's limits apply.