29 Aug
Posted by: Brandon Harper in: FreeBSD
It’s definitely a good thing to have your system clock synch itself each time you reboot using a public NTP Timeserver. FreeBSD makes this a piece of cake.
First, you’ll want to make sure your timezone is set correctly. Check /usr/share/zoneinfo for the correct time zone file, and copy it to /etc/localtime. I.e.:
bash-2.05b# mv /usr/share/zoneinfo/zonefilehere /etc/localtime
Once you’ve done that, you will need to make sure your date and time are set within at least a few minutes of the current date and time. To do this, use the date command:
bash-2.05b# date 0408290000
The date is in YYMMDDHHMM format, the clock being a 24 hour and not 12 hour clock. To make sure the date looks correct before moving on, just type date in again:
bash-2.05b# date
Sun Aug 29 00:00:33 MDT 2004
Now that our timezone, date, and time are all set correctly, lets setup the NTP daemon to keep the system time synced-up.To do this, open /etc/rc.conf in your editor of choice, and add these lines:
ntpdate_enable=”YES”
ntpdate_program=”ntpdate”
ntpdate_flags=”-b timeserver.org”
Replace timeserver.org with a server from a public NTP timeserver list which is near you (by number of network hops, not necessarily physical location). You’ll need to Google for a list of these yourself. Voila!
Why did I do this? Well, my last post said it was posted at 5 something AM.. and we all know I would never get up that early.
4 Responses
Jakob Breivik Grimstveit
30|Dec|2004 1Great. Just what I needed today. A colleague of mine had sent me an email 05:54, which I knew couldn’t be correct. And after checking with my ntp-server I figured it had to be a problem on my side. Thanks to you I got the info I needed to fix this (copy Oslo timezone file to /etc/localtime. Thanks!
Brandon
01|Jan|2005 2No problem– I’m glad this post helped you out! Mostly I blog this stuff so I can go back and look at it later when I forget something, but every now and then it helps someone else out too.
anon
08|Feb|2008 3Thanks for this guide, it helped me.
Michael Guy
16|Feb|2008 4That path is wrong for Free BSD, in /usr/share/zoneinfo/ you will not find any files. But you will find many directories that contain them. So select the directory (add that last directory on to the path given) and then copy the appropriate zone file to /etc. Most of the people who don’t know how to do date in Unix I assume are new and might may get frustrated when they find out you left a directory off of your path.
Michael Guy
Leave a reply
Search
Categories
Archives
Links
Calendar