diff --git a/check_timesync.sh b/check_timesync.sh index 0f162e59..3cbb87ad 100755 --- a/check_timesync.sh +++ b/check_timesync.sh @@ -1,12 +1,17 @@ #!/bin/bash # -# script to check if the system date & time is synced with a ntp server or something else (ie gnss receiver). +# script to check if the system date & time is synced. +# It is used to be sure that the logfile name will be correct. + +# if you want to use your gnss receiver to set time date and maybe use pps, you need +# to change this script to use ntpstat instead of timedatectl and modifying the str2str_file.service unit file dependencies +# to ntp.service or something else. ntp_exit_code=1 while [ ${ntp_exit_code} -ne 0 ] do sleep 1 - ntpstat > /dev/null + timedatectl show | grep 'NTPSynchronized=yes' > /dev/null ntp_exit_code=$? done exit 0 diff --git a/unit/str2str_file.service b/unit/str2str_file.service index 0837f471..1fac03a0 100644 --- a/unit/str2str_file.service +++ b/unit/str2str_file.service @@ -1,6 +1,6 @@ [Unit] Description=RTKBase File - Log data -Requires=str2str_tcp.service ntp.service +Requires=str2str_tcp.service systemd-timesyncd.service [Service] Type=forking