我的计时器被 CentOS7 上的系统拒绝:
$ journalctl -u synchro_ADN_To_Scality.timer --no-pager | sed 's/^.*systemd.1.: //' | sort -u
-- Logs begin at Thu 2023-04-06 10:25:28 CEST, end at Thu 2023-05-25 12:29:08 CEST. --
synchro_ADN_To_Scality.timer lacks value setting. Refusing.
[/usr/local/lib/systemd/system/synchro_ADN_To_Scality.timer:4] Failed to parse calendar specification, ignoring: Mon..Sat *-*-* 18:00:00
$ systemctl cat synchro_ADN_To_Scality.timer
# /usr/local/lib/systemd/system/synchro_ADN_To_Scality.timer
[Unit]
Description=Lancement quotidien de la Synchro des Synology ADN vers le Ring Scality
[Timer]
OnCalendar=Mon..Sat *-*-* 18:00:00
[Install]
WantedBy=timers.target
我在手册中看不到日期范围systemd.time
:
$ man systemd.time | grep -F ".."
$
CentOS7 无法识别日期范围吗?
答案1
此功能加入在 systemd 版本 231 中:
CHANGES WITH 231:
* Calendar time specifications in .timer units now understand a ".."
syntax for time ranges. Example: "4..7:10" may now be used for
defining a timer that is triggered at 4:10am, 5:10am, 6:10am and
7:10am every day.
— Berlin, 2016-07-25