working on Pi3
Situation: only one server in /etc/ntp.conf
is given and this given address is invalid (no NTP-Server running on that address).
Problem: running ntpd -qg
does never end, since there is no timeout like in ntpdate -t 60
.
Question: Can one specify a timeout for ntpd
? If not, how can you assure the process ends after time x?
For now on startup the pi executes a bash-script that tries to get actual time from given NTP-Server in /etc/ntp.conf
and then hangs in the process since there is no NTP-Server available on that address. So the process is running from start and i can't call another ntpd
until the initial ntpd
-process is killed.
Any work around?
PS: I would like not to use ntpdate since it is tagged as a retiring package
EDIT:
The RPi3 is located in an isolated network. Online NTP-servers are no option in my case.
There is a timeout
command usually shipped with coreutils that allows you to set timeout on any command (even if it does not support it on its own). E.g.
timeout 60 ntpd -qg
To run run ntpd -qg
and have it time out after 60s. If the command finished, you should get its return value, if the timeout
intervened, you get 124.