ansible/roles/i2c-clock/files/etc/systemd/system/rtc-i2c.service

23 lines
562 B
SYSTEMD
Raw Normal View History

2021-01-25 18:50:37 +00:00
[Unit]
ConditionCapability=CAP_SYS_TIME
ConditionVirtualization=!container
DefaultDependencies=no
Wants=dev-rtc_i2c.device
After=dev-rtc_i2c.device
2021-07-01 17:44:41 +00:00
Before=sysinit.target
Conflicts=shutdown.target
2021-01-25 18:50:37 +00:00
[Service]
Type=oneshot
CapabilityBoundingSet=CAP_SYS_TIME
PrivateTmp=yes
ProtectSystem=full
ProtectHome=yes
2021-07-01 17:44:41 +00:00
DeviceAllow=/dev/rtc rw
2021-01-25 18:50:37 +00:00
DevicePolicy=closed
2021-07-01 17:44:41 +00:00
ExecStart=/bin/sh -c "/usr/bin/echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"
ExecStartPost=/usr/bin/logger --tag rtc-i2c 'System clock set from i2c hardware clock'
2021-01-25 18:50:37 +00:00
[Install]
2021-07-01 17:44:41 +00:00
WantedBy=sysinit.target