ansible/roles/i2c-clock/files/etc/systemd/system/rtc-i2c.service
2021-03-09 11:33:26 +01:00

21 lines
510 B
Desktop File

[Unit]
ConditionCapability=CAP_SYS_TIME
ConditionVirtualization=!container
DefaultDependencies=no
Wants=dev-rtc_i2c.device
After=dev-rtc_i2c.device
Before=systemd-timesyncd.service ntpd.service chrony.service
[Service]
Type=oneshot
CapabilityBoundingSet=CAP_SYS_TIME
PrivateTmp=yes
ProtectSystem=full
ProtectHome=yes
DeviceAllow=/dev/rtc_i2c rw
DevicePolicy=closed
ExecStartPre=/usr/bin/echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
ExecStart=/sbin/hwclock -s
[Install]
WantedBy=time-sync.target