在 Debian(以及大多数现代 Linux 发行版)中,“定时器”通常指 systemd 定时器(systemd timers),也可以指传统的 cron 任务。下面分别说明如何列出它们。
systemctl list-timers
常见输出示例:
NEXT LEFT LAST PASSED UNIT
Thu 2026-01-15 00:00:00 5h left Wed 2026-01-14 00:00:00 18h ago apt-daily.timer
systemctl list-timers --all
systemctl status apt-daily.timer
systemctl cat apt-daily.timer
crontab -l
ls -l /etc/cron.d/
cat /etc/crontab
ls -l /etc/cron.hourly/
ls -l /etc/cron.daily/
ls -l /etc/cron.weekly/
ls -l /etc/cron.monthly/
atq
| 类型 | 查看命令 |
|---|---|
| systemd 定时器 | systemctl list-timers |
| 用户 cron | crontab -l |
| 系统 cron | /etc/crontab, /etc/cron.d/ |
| 一次性任务 | atq |
如果你是想排查某个任务为什么没执行,可以告诉我具体场景,我可以帮你分析。