Ho tre istanze di Ubuntu EC2 su Amazon AWS (UE / Irlanda), tutte configurate come web server. Ho notato che la data / ora del sistema non è corretta in due di essi (il fuso orario è sempre impostato su UTC per la mia scelta). Ecco l'output di date -R
per il mio PC (UE / Italia, 2 ore avanti rispetto a UTC) e per i server:
lorenzo@LOCALPC ~ $ date -R
Wed, 05 Jun 2013 09:48:19 +0200
ubuntu@AWS-EC2-1 ~ $ date -R # SHOULD BE 07:48 (-10 minutes)
Wed, 05 Jun 2013 07:38:58 +0000
ubuntu@AWS-EC2-2 ~ $ date -R # SHOULD BE 07:48 (-15 minutes)
Wed, 05 Jun 2013 07:33:55 +0000
ubuntu@AWS-EC2-3 ~ $ date -R # SHOULD BE 07:48 (-50 secs)
Wed, 05 Jun 2013 07:47:29 +0000
Come puoi vedere, la differenza è significativa per il primo e il secondo server EC2. Ho provato a usare ntpdate
, ma:
ubuntu@AWS-EC2-1 ~ $ ntpdate
5 Jun 07:42:10 ntpdate[3583]: no servers can be used, exiting
ubuntu@AWS-EC2-1 ~ $ cat /etc/default/ntpdate
# The settings in this file are used by the program ntpdate-debian, but not
# by the upstream program ntpdate.
# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
# so you only have to keep it in one place.
NTPDATE_USE_NTP_CONF=yes
# List of NTP servers to use (Separate multiple servers with spaces.)
# Not used if NTPDATE_USE_NTP_CONF is yes.
NTPSERVERS="ntp.ubuntu.com"
# Additional options to pass to ntpdate
NTPOPTIONS=""
Leggendo il primo commento dal file di configurazione che ho appena incollato, ho provato ntpdate-debian
:
ubuntu@AWS-EC2-1 ~ $ sudo ntpdate-debian
5 Jun 07:51:58 ntpdate[3619]: step time server 91.189.94.4 offset 561.511643 sec
L'offset di ~ 560sec corrisponde ai ~ 10min che ho trovato prima. Dopo quel comando l'ora del sistema è ok. Mi sembra strano che il sistema non lo faccia automaticamente. Dovrei usare un cron per farlo?!? Mi sto perdendo qualcosa?
ntpdate
, questa risposta ( superuser.com/a/639516/562405 ) è utile.