在 Debian 里“定时器”通常有两种常见含义:
下面分别说明排查思路和常用命令。
systemctl list-timers
看目标 timer 是否:
查看某个 timer:
systemctl status mytimer.timer
systemctl is-enabled mytimer.timer
systemctl is-active mytimer.timer
若未启用:
systemctl enable --now mytimer.timer
timer 只是“触发”,真正干活的是 .service:
systemctl status mytimer.service
journalctl -u mytimer.service
systemctl start mytimer.service
或手动触发 timer:
systemctl start mytimer.timer
journalctl -u mytimer.timer
journalctl -u mytimer.service
journalctl -xe
.timer 里写的是 OnCalendar=* 格式错误.service 里 Type=oneshot 没写~/.config/systemd/user/daemon-reloadsystemctl daemon-reload
systemctl status cron
Debian 默认可能没开 cron 日志,在:
/var/log/syslog
搜索:
grep CRON /var/log/syslog
若没有,可启用 rsyslog 的 cron 日志。
在 crontab 里加:
* * * * * echo "cron ok" >> /tmp/cron_test.log
systemctl list-timerssystemctl status xxx.timersystemctl status xxx.servicejournalctl -u xxx如果你愿意,可以把:
.timer / .service 文件贴出来,我可以帮你逐行定位问题。