schedule:run, EspoCRM’s cron.php), queue workers that should run every minute, or cleanup scripts.
Cron jobs are available for PHP, Python and Node.js apps. Static sites (HTML, React and static Next.js) have no app process to run.
Add a cron job
- Open your app and go to Settings, then Cron jobs.
- Click Add cron job.
- Choose a schedule, or Custom schedule to write a cron expression.
- Enter the command, for example
php -f cron.php. - Check the time zone and the time limit, then click Save.
Paste a crontab line
Many apps print a ready-made crontab line in their install guide, for example EspoCRM:- A
cdinto your app folder is removed, because jobs already start there; acdinto a folder inside your app becomes a relative one. - A fixed path such as
/usr/bin/php8.3,/usr/bin/nodeor/usr/bin/python3becomesphp,nodeorpython, so the job uses your app’s chosen version. - When the line has no PHP path before
-f(some guides leave it empty),phpis added.
cd to the app folder or the full path to php, node or python.
Schedules
A schedule has five fields: minute, hour, day of the month, month and day of the week (0 or 7 is Sunday).
Each field accepts
*, a number, a range (1-5), a list (1,15) and a step (*/10, 0-30/10). @hourly, @daily, @weekly, @monthly and @yearly also work. Names such as MON or JAN are not accepted.
Times are in the job’s time zone (your workspace’s default is shown when you add a job). The page shows when each job runs next.
How jobs run
- Your app’s own user. A job runs as the same user as your app and its terminal, never as an administrator. It cannot use
sudo, gain privileges or see other apps and their processes. - Your app’s settings. It gets your app’s variables (and secrets), and runs with your app’s PHP version, Node.js version or Python virtualenv.
- A time limit. A job is stopped with everything it started when it reaches its time limit (5 minutes by default, at most 15).
- No overlaps. If a run is still going when the job is due again, that time is skipped.
- Only while your app runs. Jobs of stopped, paused or not yet deployed apps do not run.
History and Run now
History shows the status, exit code and output of a job’s last 20 runs. A run is success when the command exits with 0, failed otherwise, timeout when it reached the time limit, and skipped when it could not start. Run now runs a job once right away, which is useful to test a new command. Pause stops a job from running on its schedule until you resume it.Output can include sensitive values your command prints. Only workspace members who can manage the app can see cron jobs and their output.
