大网数据广告活动
服务器运维问答

systemd timer NEXT time is in the past

· 52CE 我爱测

I have a systemd timer that I would like to run every weekday morning at 5:30am. Here's the .timer file: [Unit] Description=My Cool Timer [Timer] OnCalendar=Mon-Fri 05:30:00 [Install] WantedBy=timers.target I set up this timer la…

问题原文

原帖链接 · rcv · CC BY-SA 3.0

I have a systemd timer that I would like to run every weekday morning at 5:30am. Here's the .timer file:

[Unit]
Description=My Cool Timer

[Timer]
OnCalendar=Mon-Fri 05:30:00

[Install]
WantedBy=timers.target

I set up this timer last night, and it fired this morning right on schedule. However, checking on its status shows that it's next scheduled firing (LEFT) is 8 hours ago:

boatzart@machine: sudo systemctl list-timers myCoolTimer.timer
NEXT                         LEFT     LAST                         PASSED             UNIT                         ACTIVATES
Thu 2016-09-01 05:30:00 PDT  8h ago   Thu 2016-09-01 05:30:00 PDT  8h ago             myCoolTimer.timer          myCoolTimer.service

I'm not sure if it matters, but the associated .service file is Type=forking.

How do I get my timer to actually repeat?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 3.0

I think you missed this bit of the documentation:

Note that in case the unit to activate is already active at the time the timer elapses it is not restarted, but simply left running.

The timer does nothing at the next scheduled time, because the service is already running.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。