1

I'm using a Raspberry Pi, and upon startup it's sending an e-mail with the time and an IP address. The problem is that the time is not correct, it's the time from last time the system was shut down. When I log in through ssh and do a date command, I get the correct time. In other words, the e-mail is sent before the system has updated its time.

I was thinking of automatically running ntpdate on boot, but after reading up on it it seems like a bad idea due to the many risks of error.

So, can I somehow wait until the time has been uppdated before continuing in a script?

Paolo
  • 2,161
  • 5
  • 25
  • 32

1 Answers1

0

There is a tool included in the ntp reference implementation for this very purpose. The utility has a rather cryptic name: ntp-wait. Five minutes with the man page and you will be all set.

dfc
  • 792
  • 5
  • 16