Time and date sync with htpdate.

Basil V.Prokudin

New Member
Joined
Mar 18, 2019
Messages
3
Reaction score
0
Credits
0
Ubuntu have htpdate packet for time sync with compability servers.
But after update Ubuntu (Xubuntu) to 1904 good old htpdate dont working :(
Like this:

:~# htpdate -a -s -P proxy.server.my:8000 ntp21.vniiftri.ru
No server suitable for synchronization found

But server return answer!

:~# htpdate -d -q -P proxy.server.my:8000 ntp21.vniiftri.ru
burst: 1 try: 1 when: 500000
ntp21.vniiftri.ru 80 06 Jun 2019 04:33:14 GMT (0.130) => -1559795594
burst: 1 try: 2 when: 500000
ntp21.vniiftri.ru 80 06 Jun 2019 04:33:15 GMT (0.158) => -1559795595
No server suitable for synchronization found

I think, problem is in TZ, it is (MSK+2), not (GMT+5).

:~# tzselect
4) Asia > 38) Russia > 10) MSK+02 - Urals
The following information has been given:
Russia
MSK+02 - Urals
Therefore TZ='Asia/Yekaterinburg' will be used.

But I not sure in this.
I wrote script, which use server answer and setup system and hw clock.

Bash:
timedatectl set-local-rtc 1 --adjust-system-clock
date
time=`htpdate -dq -P proxy.server.my:8000 ntp21.vniiftri.ru | head -c78 | tail -c20`
echo "VNIIFTRI TIME IS: $time"
lotime=$(date -d "$time today + 5 hours" +'%d %b %Y %H:%M:%S')
echo "LOCAL TIME IS: $lotime"
lotime=$(date -d "$time today + 5 hours" +'%H:%M:%S')
lodate=$(date -d "$time today + 5 hours" +'%Y%m%d')
date -s $lodate > /dev/null
date -s $lotime
hwclock --systohc
 

Members online


Top