I am setting up a server with several VPS. I am using LXC. I am thinking it would be better to have only the main server equipped with ntp and have the virtual boxes just get the time from the main box. Is there a bash/python/php etc script I could use to get the time from the main server?

  • Here is an idea. Set on the main server the hwclock, and have the VPSs pick that up. How does that sound? – RoboTamer Dec 12 '11 at 8:17
  • Doing a bit more research. It seams I can run the /etc/init.d/hwclock.sh once in a while to set all clocks. when run with start it set the hardware clock, so this would be done on the main server where I have ntp running and the vps'es could run it with stop to set the system clock, again with a cron job every now and then. How does that sound? – RoboTamer Dec 12 '11 at 8:38

Got no answer, so here is what I did, and I am wondering if there are any consequences to this that I should be aware of.

Main server cron job

* 0 *  * * /sbin/hwclock -w

Each VPS has following cron job

10 0 *  * * /sbin/hwclock -s


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.