Omarchy

How-To: List Every Scheduled Job on a Linux Box, systemd Timers and cron

Leave a comment

My bots run on schedules, and the first question when something fires twice, or not at all, is “what’s actually scheduled on this machine?” Here’s the read-only inventory I use.

1. systemd timers, system and user

systemctl list-timers --all
systemctl --user list-timers --all

NEXT and LAST tell you when each timer will fire and when it last did. User timers are easy to forget, and they only run while that user’s manager is running unless lingering is on (loginctl show-user $USER -p Linger).

2. See what a timer really runs

systemctl cat mything.timer mything.service
journalctl -u mything.service --since today

3. Sanity-check a schedule before you trust it

systemd-analyze calendar "Mon..Fri 13:00" --iterations=3

It prints the next few times it would fire, in your local time zone. Great for catching off-by-one-hour mistakes.

4. Don’t forget cron

crontab -l
sudo ls /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly 2>/dev/null
sudo ls /var/spool/cron/ /var/spool/cron/crontabs/ 2>/dev/null

The spool directory shows every user that has a personal crontab. Read them with sudo crontab -l -u NAME.

5. Look for the duplicates

If the same script shows up in a timer and a crontab, that’s your “ran twice” bug. Pick one scheduler per job and remove the other on purpose, after you’ve backed it up.

God Bless, and Use the Source!

References & Further Reading

Subscribe (RSS) Follow How-Tos via RSS

Leave a note

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.