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 jobs | Background workers (daemons) | |
|---|---|---|
| Runs in | Host server | App container |
| Access to | Host OS, Docker, all containers | App environment, env vars |
| Restart on failure | No (cron fires again on schedule) | Yes (restart policy) |
| Good for | Docker maintenance, disk cleanup, server-level scripts | App 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
- Go to Servers → (your server) → Cron Jobs.
- Click Add Cron Job.
- 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, ordeployer)
- Name — a label for the job (e.g.
- 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.
| Example | Meaning |
|---|---|
0 3 * * * | Every day at 3:00 AM |
*/15 * * * * | Every 15 minutes |
0 0 * * 0 | Every 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
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.