Automation · Bash Automation
cron
Cheat sheet · https://pcornel.dk/topic.php?topic=5289
Answer
cron runs commands on a schedule defined in crontab lines like 30 2 * * * /opt/backup.sh, with minute, hour, day, month and weekday fields. Redirect output to a log, since cron has a minimal environment.
Remember
- Five fields: minute hour day month weekday.
- Minimal environment.
- Redirect output to a log.
First checks
crontab -l— user jobsls /etc/cron.d/— system jobsgrep CRON /var/log/syslog / journalctl -u cron— execution logs
Verify in this order
schedule → cron → command → log
Where it usually breaks
Trigger → queue accepted → worker lease/pickup → task running → terminal result → target mutation/read-back → effective runtime state → workload.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5289