How to Automate Commands Using Cron Jobs (Linux, Debian-based)
Cron is a time-based job scheduler available in most Unix-like operating systems.
It allows system administrators to automate repetitive tasks such as fan control or system monitoring.
This guide demonstrates how to use Cron jobs on Debian-based systems, including integration with ipmitool.
Overview
Section titled “Overview”Cron jobs execute commands automatically at scheduled times defined in a specific syntax.
Basic Syntax
Section titled “Basic Syntax”* * * * * <command>│ │ │ │ ││ │ │ │ └── Day of week (0–6)│ │ │ └──── Month (1–12)│ │ └────── Day of month (1–31)│ └──────── Hour (0–23)└────────── Minute (0–59)Example Jobs
Section titled “Example Jobs”33 * * * * root <command>56 * * * * root ipmitool raw 0x30 0x70 0x66 0x01 0x01 0x0055 * * * * root ipmitool raw 0x30 0x70 0x66 0x01 0x00 0x00Explanation:
- The first job runs every 33rd minute of every hour.
- The following two set fan speeds in two chassis zones at minute 55 and 56.
Ensure TAB spacing between time fields, user, and command.
Configuration
Section titled “Configuration”On Debian-based systems (Proxmox, Ubuntu, TrueNAS SCALE)
Section titled “On Debian-based systems (Proxmox, Ubuntu, TrueNAS SCALE)”Edit Cron jobs:
crontab -eor system-wide jobs in /etc/crontab.
In TrueNAS SCALE:
System → Cron Jobs → Add
Verification
Section titled “Verification”List all Cron jobs:
crontab -lTest the command manually before scheduling.
Related Guide
Section titled “Related Guide”See How to Control Fan Speed Using IPMI-tool Raw Commands.
References (APA)
Section titled “References (APA)”Vixie, P. (1994). Cron Daemon Documentation. Internet Systems Consortium (ISC).