在Debian系統中,可通過以下方式監控定時器服務:
sudo systemctl list-timers --all
。sudo systemctl status <timer_name>.timer
。journalctl
查看定時器關聯服務的日志:sudo journalctl -u <timer_name>.service
。systemd-analyze blame
查看任務執行耗時。journalctl -u <timer_name>.service -f
。systemctl list-dependencies <timer_name>.timer
。sudo apt install ntp && sudo systemctl enable --now ntp
。注:以上操作基于systemd
定時器(非傳統cron
),需將服務與定時器文件放置在/etc/systemd/system/
目錄下。