Skip to content

Commit

Permalink
switch to timedatectl to fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefal committed Oct 23, 2019
1 parent d49f539 commit 7afb3e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions check_timesync.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion unit/str2str_file.service
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 7afb3e3

Please sign in to comment.