Automation: Scheduling, CI & Best Practices
Running scripts on a schedule (cron, systemd timers, Task Scheduler), in CI pipelines, and keeping them maintainable.
Scripts become valuable when they run without anyone typing them: every night, after every commit, when a board is connected. This lesson collects the ways to schedule and integrate scripts, and the habits that keep them working for years. (It has no example output: these are system configuration steps.)
Maintainable scripts
A cron job that works when you run it by hand but not from cron
Use absolute paths and set PATH and the working directory inside the script cron runs with a minimal environment: a different PATH, no shell profile, and the home directory as working directory.
What does the cron line 30 6 * * 1-5 mean?
At 06:30 every Monday to Friday.