Fix Time on Arch Linux Systems (Run ntpd -s every hour using systemd)

My Raspberry Pi running Arch Linux didn't get the proper time on system startup and here is the solution I came up with to solve this problem:

Create the file /etc/systemd/system/fix-time.service:

[Unit]
Description=Set the time using NTP time servers

[Service]
Type=simple
ExecStart=/usr/sbin/ntpd -s

and the file /etc/systemd/system/fix-time.timer:

[Unit]
Description=Runs fix-time every hour

[Timer]
# Time to wait after booting before we run first time
OnBootSec=10
# Time between running each consecutive time
OnUnitActiveSec=1h
Unit=fix-time.service

[Install]
WantedBy=multi-user.target

Now activate the whole thing:

systemctl daemon-reload
systemctl status fix-time.timer
systemctl start fix-time.timer
#Enable it to be started on bootup:
systemctl enable fix-time.timer

Resources

Comments