Skip to main content

Server Cron Jobs

Server cron jobs let you schedule shell commands to run on a fixed schedule on your provisioned server. Unlike background workers (which run inside your app's container), cron jobs run directly on the host server as a system cron entry.

When to use server cron jobs vs. daemons

Server cron jobsBackground workers (daemons)
Runs inHost serverApp container
Access toHost OS, Docker, all containersApp environment, env vars
Restart on failureNo (cron fires again on schedule)Yes (restart policy)
Good forDocker maintenance, disk cleanup, server-level scriptsApp queues, schedulers, workers

Use server cron jobs for things like pruning old Docker images, taking database snapshots at the OS level, or running maintenance scripts that need host access.

For app-level scheduled tasks (e.g. php artisan schedule:run, python manage.py send_digests), use a background worker daemon with a shell loop instead.

Adding a cron job

  1. Go to Servers → (your server) → Cron Jobs.
  2. Click Add Cron Job.
  3. Fill in:
    • Name — a label for the job (e.g. Docker image cleanup)
    • Command — the shell command to run (e.g. docker image prune -f)
    • Schedule — a standard 5-field cron expression
    • User — which system user runs the command (root, ubuntu, www-data, or deployer)
  4. Click Save — Vessl syncs the cron entry to the server immediately via SSH.

Cron schedule syntax

Cron uses a 5-field expression: minute hour day-of-month month day-of-week.

ExampleMeaning
0 3 * * *Every day at 3:00 AM
*/15 * * * *Every 15 minutes
0 0 * * 0Every Sunday at midnight
30 6 1 * *1st of every month at 6:30 AM
0 */6 * * *Every 6 hours

Times are in the server's local timezone (usually UTC for freshly provisioned VPS).

Enabling and disabling

Toggle the switch next to any cron job to enable or disable it without deleting it. Vessl updates the server's crontab immediately.

Deleting a cron job

Click the trash icon next to the cron job. Vessl removes the entry from the server's crontab immediately.

Common use cases

Prune old Docker images (weekly)

0 2 * * 0
docker image prune -f

Restart a specific container nightly

0 4 * * *
docker restart vessl-app-<id>

Clear temp files

0 1 * * *
find /tmp -name "vessl-*" -mtime +7 -delete
caution

Cron jobs run as the specified system user on the host — they have access to the full server. Only create cron jobs for tasks you'd trust a shell script to do.