LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Setting correct time (https://www.linuxquestions.org/questions/linux-general-1/setting-correct-time-4175528788/)

laredotornado 12-19-2014 02:49 PM

Setting correct time
 
Hi,

I'm using the Amazon flavor of Linux ...

Code:

uname -a
Linux mydomain.org 3.12.33-36.140.amzn1.x86_64 #1 SMP Thu Aug 14 22:00:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I am aware that I can set the date manually using the "date --set" command, but is there a more precise way to keep the date current? The timezone of our server is GMT.

Thanks, - Dave

sudowtf 12-19-2014 03:14 PM

install ntp and insure the service autostarts

veerain 12-19-2014 11:43 PM

First set the system time with date command within few seconds correctness. Then use ntp daemon to set it correctly in 100s of milliseconds.

Mr. Alex 12-20-2014 02:46 PM

Quote:

Originally Posted by laredotornado (Post 5287704)
is there a more precise way to keep the date current?

Configure date and time in BIOS. Linux takes them from there while booting.

onebuck 12-22-2014 09:19 AM

Member response
 
Hi,

Quote:

Originally Posted by laredotornado (Post 5287704)
Hi,

I'm using the Amazon flavor of Linux ...

Code:

uname -a
Linux mydomain.org 3.12.33-36.140.amzn1.x86_64 #1 SMP Thu Aug 14 22:00:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I am aware that I can set the date manually using the "date --set" command, but is there a more precise way to keep the date current? The timezone of our server is GMT.

Thanks, - Dave

I use a 'time' scrript placed in '/etc/cron.hourly';
Code:

~# cat /etc/cron.hourly/time
#!/bin/sh
#11-06-06 gws use ntp
 /usr/sbin/ntpdate -v 0.us.pool.ntp.org ntp-1.mcs.anl.gov ntp-2.mcs.anl.gov &&hwclock --systohc
#--hctosys


#/usr/sbin/netdate time.mtco.com && /sbin/hwclock --systohc

Please be courteous and continue to use a 'pool' so as not to load primary time servers.
Hope this helps.
Have fun & enjoy!
:hattip:

veerain 12-22-2014 10:51 PM

ntpdate is not good for updating live linux. Some programs may not run or crash in the middle or work wrongly. You should use ntpd and not ntpdate from ntp software.


All times are GMT -5. The time now is 07:00 AM.