I'm running wp on lamp install in virtual machine. I frequently pause it, save snapshots, etc. Date and time aren't correct because of this and i think i noticed weird behavior of plugins that use cron. How do i fix my time and plugins? Maybe i should get time from external location so it would be correct even though i regularly pause my machine?
It's Debian Lenny guest on other linux host. I'm using virtualbox.
What you need is Time Synchronization, which is a feature of the Guest Additions in Virtual Box. Looks like it wasn't installed. From the Virtualbox manual:
Install instructions here.
To syncronise time, use NTP (Network time protocol).
Firstly, sync time with
sudo ntpdate ntp.ubuntu.com
Then, install ntpd
sudo apt-get install ntp
VMs don't always play well with ntp.
If you are using VMware, install the VMware tools. Then, there is a setting in the
.vmx
file calledtime.syncTime
that should be set toTRUE
(although the time seems to be staying sync'd since I install VMware Tools even set to the defaultFALSE
).Here are some other VMware settings: (from http://www.vmware.com/pdf/vmware_timekeeping.pdf):
tools.syncTime
If set toTRUE
, the clock syncs periodically.time.synchronize.continue
If set toTRUE
, the clock syncs after taking a snapshot.time.synchronize.restore
If set toTRUE
, the clock syncs after reverting to a snapshot.time.synchronize.resume.disk
If set toTRUE
, the clock syncs after resuming from suspend and after migrating to a new host using the VMware VMotion feature.time.synchronize.shrink
If set toTRUE
, the clock syncs after defragmenting a virtual disk.time.synchronize.tools.startup
If set toTRUE
, the clock syncs when the tools daemon starts up, normally while the guest operating system is booting.or add this to root's crontab in the virtual machine