Only sync ntp once per week, sync to hardware clock

This commit is contained in:
2024-01-10 15:22:08 -05:00
parent 60d94900d7
commit 0b4ba9560a
3 changed files with 10 additions and 3 deletions
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
old_timestamp="$(</etc/local.d/.ntpsync)"
new_timestamp="$(date +%s)"
if [ "$((new_timestamp-old_timestamp))" -gt 604800 ]; then
ntpdate -b pool.ntp.org
hwclock --systohc --utc
echo "$new_timestamp" > /etc/local.d/.ntpsync
fi