brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: systemctl list-timers is cron's answer inside systemd

Systemd
~/tips/tip-linux-systemctl-list-timers

systemctl list-timers --all

Shows every scheduled systemd timer with its last and next run time.

Where did that nightly job come from? On many modern systems the answer is a systemd timer, not crontab.

List them all:

systemctl list-timers --all

You get the next run, the time left, the last run and the service each timer starts. That covers things like log rotation, package updates and fstrim on a lot of distributions.

To see what a timer actually does, run systemctl cat fstrim.timer and then look at the matching .service. To see the output of its last run, use journalctl -u fstrim.service.

One caveat: this only shows systemd timers. Jobs in crontab or /etc/cron.d are not listed, so a missing entry does not prove nothing runs. Check both places before you say a job does not exist.

I find this the quickest answer to why something ran at an odd hour. Timers have a random delay option as well, so the time shown is not always the exact minute. It also shows quickly whether a maintenance job you assumed was off is still scheduled.

Further reading: systemctl man page, systemd.timer man page, On this site: switch off WP-Cron and let a real cron job do the work, On this site: wp cron event run –due-now runs the stuck scheduled tasks

Going deeper: Guide: find out why a Linux service failed, with journalctl

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link