I have a dedicated web server which is running centos with xen virtualization that has centos installed on the vm. I do not have access to the parent server, I can only manipulate the vm, of which I have full control. I am having nothing but problems manipulating the date/time on the vm. The main problem now is that the time on my server is running just a little faster than "normal". I would estimate that for every 24 hours it is ahead by an extra minute. This is not good because I have scripts that need to be run at specific times and they are running minutes behind what they should. The only "fix" I have found so far is to reboot the server, but I don't want to reboot every night just to fix the time!
Here is what I have tried:
1) Setting the time manually:
root@host [~]# date Mon May 13 06:52:22 WAKT 2013 root@host [~]# date 051306492013 Mon May 13 06:49:00 WAKT 2013 root@host [~]# date Mon May 13 06:52:54 WAKT 2013
The date and time is reflected on the screen after the set command, but then when I run the date command a second later, it goes back to what the date "actually is". If I reboot the server, the time will be reset properly, but I am trying to avoid this reboot.
2) I was reading about setting the hardware clock which might help me, but I am unable to make any changes or do anything with it, and I believe it is because I am on a vm:
root@host [~]# /sbin/hwclock --show Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method. root@host [~]# hwclock --systohc Cannot access the Hardware Clock via any known method. Use the --debug option to see the details of our search for an access method.
3) I enabled ntp, which I believe is working, but like setting the time manually, the time change doesn't "stick" until after a reboot:
root@host [~]# date Mon May 13 06:55:36 WAKT 2013 root@host [~]# service ntpd stop Shutting down ntpd: [ OK ] root@host [~]# ntpdate pool.ntp.org 13 May 06:55:52 ntpdate: step time server 126.96.36.199 offset -229.150633 sec root@host [~]# service ntpd start Starting ntpd: [ OK ] root@host [~]# date Mon May 13 06:56:10 WAKT 2013
Also note that I am using some weird timezone for the moment because I was trying to troubleshoot another issue I was having with the timezone being reset: Timezone changing by itself on virtualized centos install so don't focus too much on the timezone. I just need the time to be correct for whatever timezone I am in.
Has anyone dealt with this before? I refuse to believe that there is no way to set the time on my linux box without a reboot. Any ideas or suggestions are most welcome!