examples: fix unset OPTIONS variable warning in systemd services

Modify chronyd.service to handle cases where OPTIONS is undefined,
which occurs when /etc/sysconfig/chronyd doesn't exist or doesn't set
the variable. This prevents the warning:

 "chronyd.service: Referenced but unset environment variable
  evaluates to an empty string: OPTIONS"
This commit is contained in:
Andreas Fenkart
2025-05-12 10:32:57 +02:00
committed by Miroslav Lichvar
parent f5fdfee150
commit 0bf7e49148
2 changed files with 2 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ ConditionCapability=CAP_SYS_TIME
[Service]
Type=notify
PIDFile=/run/chrony/chronyd.pid
Environment="OPTIONS="
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd -n -U $OPTIONS

View File

@@ -8,6 +8,7 @@ ConditionCapability=CAP_SYS_TIME
[Service]
Type=notify
PIDFile=/run/chrony/chronyd.pid
Environment="OPTIONS="
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd -n $OPTIONS