grep -rl "automation" ./blog

Linux Automation and Scheduling

Making the machine do it for you: cron, systemd timers, scheduled scripts, backup automation, and workflow tools.

14 articles

OpenTofu vs Terraform: Licensing, Compatibility, and How to Switch OpenTofu forked from Terraform after HashiCorp moved to the Business Source License in 2023. How the two differ now, what OpenTofu adds such as state encryption, how compatible they remain, and how to migrate a project. systemd User Services: Running Your Own Services Without Root systemctl --user lets any user run background services and timers under their own account, with logging, restarts, and dependencies. Where unit files go, how lingering keeps them running after logout, and common pitfalls over SSH. Terraform Basics: Declarative Infrastructure How Terraform tracks what it built in state, why that file is the whole design, and where OpenTofu fits after the licence change. Ansible Basics: Configuration Management Without Agents How Ansible pushes configuration over SSH, what idempotency means in practice, and how to write your first inventory and playbook without adopting a whole methodology. Makefiles Explained: Tabs, Targets, and Why make Is Still Useful How make decides what to rebuild, why the tab requirement exists, what .PHONY is for, and why make is a reasonable task runner even for projects that compile nothing. cloud-init: Configuring a Machine on Its First Boot The standard mechanism for turning a generic cloud image into a configured machine. It sets hostnames, installs SSH keys, creates users, and runs commands, once, before you ever log in. Bash Error Handling: set -euo pipefail and Why Your Script Needs It By default a bash script that fails halfway through keeps running as if nothing happened. Three options change that, and knowing exactly what each one does is the difference between safety and mystery. udev Rules Explained: Making Devices Behave the Way You Want Device names are not stable, permissions default to root, and nothing happens automatically when you plug something in unless you tell it to. udev rules fix all three. Writing systemd Service Files Explained Beyond using systemctl to manage existing services, writing your own .service unit file lets you run any script or program as a properly managed systemd service. This guide covers unit file structure, common directives, and enabling a custom service. Writing Your First Bash Script A practical introduction to Bash scripting: the shebang line, variables, arguments, conditionals, loops, and functions, with runnable examples you can adapt for real automation tasks. Automated Backups on Linux A practical guide to setting up automated backups on Linux using rsync, tar, and dedicated tools like restic and Borg, following the 3-2-1 rule, scheduling with cron or systemd timers, and actually verifying backups work. Writing Scheduled Scripts That Actually Work on Linux Scripts that run fine interactively often fail silently when triggered by cron or systemd timers. This guide covers the practical differences: environment variables, working directories, logging, locking, and failure notification for scripts meant to run unattended. Cron Jobs Explained Cron is the classic Unix job scheduler. This guide covers the crontab syntax, the five time fields, user and system crontabs, the cron.d and cron.daily directories, environment variables, logging, and common pitfalls. Scheduling Tasks with systemd Timers systemd timers are the modern alternative to cron for scheduling tasks on Linux. They offer better logging, dependency support, randomisation, and integration with the rest of the systemd ecosystem.