⏱️ Cron
crestic cronRun scheduled jobs based on cron expressions.
Description
crestic cron is designed to be executed by system schedulers (cron, systemd timers, launchd, etc.).
When launched, it:
- Determines which jobs should have run since the last execution time
- Executes all due jobs in the correct order
- Remembers last run time (won't miss jobs)
Locking behavior
- Only one instance of
crestic croncan run per configuration file name - A lock file is created in
~/.crestic/and uses only the filename of the config, not the full path or extension- Example:
/etc/backup/crestic.yamland/etc/backup/crestic.ymlwill share the same lock my.ymlandconfig.ymlwill run in parallel, as their filenames differ
- Example:
- This prevents two processes from running the same jobs simultaneously, while still allowing multiple independent configs to run at the same time
Examples
# Run scheduled jobs (typically called from system cron)
crestic cron
# Add to system crontab
*/5 * * * * /usr/local/bin/crestic cron --config /path/to/crestic.yamlScheduling
Define cron expressions in job configuration:
jobs:
- name: daily-backup
cron: "0 2 * * *" # Daily at 2 AM
# ... rest of config
- name: hourly-backup
cron: "0 * * * *" # Every hour
# ... rest of configNotes
- Crestic stores the last execution timestamp to ensure jobs are run even if cron wasn’t triggered exactly on time (e.g. machine was off)
- If no job is due — it exits without doing anything
- If a job fails, Crestic proceeds to the next one (jobs are independent)