Changing time zones on FreeBSD

I recently needed to change the timezone on my FreeBSD servers form the default to GMT. This was required as the servers were to be used for GPS based vehicle tracking system which always send date/time in GMT. After a little bit of searching on Google, I was able to come with the following method. Nothing great, just that this blog post would help me in remembering it later on:

First, copy the GMT time zone file to make it the default timezone of the server. The same can be done for any timezone you wish for.

cp /usr/share/zoneinfo/GMT /etc/localtime

[Updated: For FreeBSD 9+ GMT has been replaced by UTC. The code would change to cp /usr/share/zoneinfo/UTC /etc/localtime

Update your server with teh correct date/time using the ntp command

ntpdate -v -b

Check the server time using date command


Now, to make sure that computer syncs itself everytime it boots, add these two lines to your /etc/rc.conf


[Updated: FreeBSD already comes in with  a ntpd and ntpdate binary. No need to install separate ports for just syncing the time.]

China Visit during March-April

I visited China during the period of March-April this year. Had lots of business work to do, mainly dealing with hardware suppliers of GPS based vehicle tracking systems, but could squeeze out time on Sunday for a trip to shenzhen beach. Few pics, including the friend who literally acted as my interpreter:Beach Creature

Initializing Postgresql 8.x on FreeBSD

I was recently creating a system with FreeBSD 7.x with Postgresql 8.x . The installation was done through ports and it went through smoothly. Instructions at the end of installation process were of no help.

For some reason, it would not initialize the database, nor would it give out any errors. Just to make sure, I ran this command both as root and as postgres user, but the result was same. It would neither log any message to the system log file.

A simple search through the Postgresql docs ( )gave an alternate way which worked for me:

# su - pgsql
$ initdb -D /usr/local/pgsql/data