Deploy

Cron jobs

Run commands on a schedule, as the app's own user with its variables, as systemd timers.

Each project's Cron jobs page holds commands that run on a schedule. A job has:

  • A name: lowercase, like sync-orders.
  • A schedule: five cron fields, like */30 * * * * (every 30 minutes) or 0 3 * * * (every night at 03:00), or a shorthand: @hourly, @daily, @weekly, @monthly or @yearly. The page says in words when it runs. Times are the server's, UTC.
  • A command: like node scripts/sync.mjs or npm run cleanup. It runs in the live build of the app, as the app's user, with its environment variables, on its Node version, in the same sandbox as the app.

Run now starts a job at once. The job's page lists its recent runs, with their output and exit codes. A failing job raises an alert.

If the server was off when a job was due, it runs once after the server starts again.

On the server

Each job is a systemd timer and a service, named after the app and the job:

systemctl list-timers 'app-<app>-cron-*'    # every job and its next run
journalctl -u 'app-<app>-cron-<name>'       # a job's output, run by run