Linux & shell: Scheduling: cron & systemd timers
6 Linux & shell commands: Scheduling: cron & systemd timers. Click a command to see what each part does.
Linux & shell: Scheduling: cron & systemd timersIndex
- Whole sheet251
- Navigate & list13
- Create, copy, move, delete13
- View & compare files9
- Permissions & ownership31
- Help & shell basics11
- Users & groups6
- Install packages7
- Package & software versions29
- System info9
- Network basics & SSH10
- Zip & compress4
- Shell operators6
- Processes6
- Files & search8
- Text processing pipelines4
- Disk3
- Network5
- Services & logs6
- Archives & copying4
- Firewall7
- Scheduling: cron & systemd timers6
- Storage, mounts & LVM10
- Kernel, hardware & limits8
- Performance & tracing10
- TLS & certificates8
- Packet capture & network debugging10
- Terminal tools8
Scheduling: cron & systemd timers6
crontab -l; crontab -eList and edit your cron jobsWhat each part does
crontab -lshow your user's cron jobs (sudo crontab -l -u <user> for others)crontab -eedit them in $EDITOR
*/5 * * * * /usr/local/bin/<script> >> /var/log/<script>.log 2>&1Cron line formatWhat each part does
*/5 * * * *minute hour day-of-month month day-of-week: here every 5 minutes/usr/local/bin/<script>use full paths: cron has a minimal PATH>> <log> 2>&1append output and errors to a log, otherwise they are mailed or lost
ls /etc/cron.d /etc/cron.daily /etc/cron.hourly; cat /etc/crontabSystem-wide cron jobsWhat each part does
/etc/cron.djob files from packages and admins (with a user field)/etc/cron.daily, hourly...scripts run by run-parts at those intervals
journalctl -u cron -u crond --since todayDid cron run my job?What each part does
journalctl -u cron -u crondcron daemon logs (cron on Debian, crond on RHEL); or grep CRON /var/log/syslog--since todayonly today
systemctl list-timers --allList systemd timers and when they run nextWhat each part does
list-timersevery timer: next run, last run, the unit it starts--allinclude inactive timers
echo '<command>' | at 02:00Run a command once at a later timeWhat each part does
at 02:00run once at 2 AM (also: at now + 30 minutes); atq lists, atrm removes
Nothing matches.
My DevOps Playbook by Angelo John Calleja