[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

sync date with NTPd

Posted on 2011-10-01
6
Medium Priority
?
603 Views
Last Modified: 2013-12-16
hello,
I am on EST time using centos v5.7 and right now its 1.56pm I started the NTPd service

service ntpd start
chkconfig ntpd on

then I check and this is what I get

[(12:20 PM)][(root@critical)] [(~)] $ date
Sat Oct  1 12:56:03 EST 2011

how can I fix the date?
0
Comment
Question by:XK8ER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36897342
The correct timezone currently is actually EDT, and that is why your server is showing 1 hour off.

Change/confirm your timezone by using tzselect
[root@broken etc]# tzselect
Please identify a location so that time zone rules can be set correctly.
<snip>
The following information has been given:

        United States
        Eastern Time

Therefore TZ='America/New_York' will be used.
Local time is now:      Sat Oct  1 14:13:48 EDT 2011.
Universal Time is now:  Sat Oct  1 18:13:48 UTC 2011.
Is the above information OK?

Open in new window

0
 
LVL 1

Author Comment

by:XK8ER
ID: 36897393
that doesnt change the time for the system, this is what I get.


You can make this change permanent for yourself by appending the line
        TZ='America/New_York'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
America/New_York
[(01:23 PM)][(root@alpha)] [(~)] $ date
Sat Oct  1 13:23:50 EST 2011

Open in new window

0
 
LVL 21

Accepted Solution

by:
Papertrip earned 2000 total points
ID: 36897430
My apologies you are correct, I didn't fully complete the test when I ran it on my server.  All that shows you is which value you should be using but doesn't actually change it.  I had thought it would change /etc/localtime, so let's just do that manually.
[root@broken America]# pwd
/usr/share/zoneinfo/America
[root@broken America]# date
Sat Oct  1 11:54:32 PDT 2011
[root@broken America]# cp -p New_York /etc/localtime
cp: overwrite `/etc/localtime'? y
[root@broken America]# date
Sat Oct  1 14:54:20 EDT 2011

Open in new window

If that does the trick, then change /etc/sysconfig/clock to match
[root@broken America]# cat /etc/sysconfig/clock
ZONE="America/New_York"

Open in new window






0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 1

Author Comment

by:XK8ER
ID: 36897436
ok, the time is now correct.. now when the time changes into daylight saving.. would it change automatically?
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36897447
Yes it will.

You may want to restart any applications that could have the old TZ cached.  I have never changed the timezone on a server apart from during the install, so I'm not sure of the repercussions of doing it on the live system.

If you are able to reboot the machine, that would be the safest, but is probably unnecessary... your call on that.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36897456
I think crond would be the only service that needs to restart so that it can rotate the logs right at 4am.. other than that when I change the date its all good.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question