Daylight Savings Time and Unix Cron

Until recently I was of the opinion that, in Ireland, when the clocks change in Spring and Autumn to account for Daylight Savings Time, they always do so at 2am. Having never given it too much thought over the years, I was surprised to find out last weekend that the time they actually change differs depending on whether the clocks are going forward (Spring) or backward (Autumn).

In Ireland, the clocks go forward one hour at 1am (in Spring) but when they go back again in Autumn, they actually do so at 2am. You can confirm this for yourself on the Greenwich Meantime site for Ireland.

There is an important lesson in this too for administrators of the Unix operating system. Never schedule an import cron task between the hours of 1:00am and 2:00am because if you do, it will not run on the weekend when DST comes into effect and it may be run twice on the weekend where DST ends.

Unix Time Milestone

For those of you unfamiliar with how computers actually keep track of time, most computers running the Unix operating system do so based on the number of seconds that have elapsed since 1st January 1970. Pretty much everything do with with elapsed time (internally in the operating system) is based on this date.

Now for those of you still actually reading this post, at precisely 11:31:30pm on Friday, 13th February 2009 (i.e. tonight), this internal time representation will hit somewhat of a milestone (for 32-bit computer systems) in that the number of seconds that will have elapsed since 1st January 1970 will be exactly 1234567890.

OK, I admit, it’s not quite the same as landing a man on the moon but worth a mention all the same I feel. One for the pub perhaps.

Source: SlashDot

Useful tricks and tips for Geeks

I’ve encountered a number of SlashDot posts over the past week or so which discuss some of the more useful aspects of several computing tools that I use regularly. I’d commented on the first two individually (Forgotten Unix Tricks and Useful Vim Tricks) but since then, several more have emerged.

So, here are the links to each of them in one post, showing their original titles (not mine):

If someone (not me) were to make these into a book, I reckon it would prove to be quite popular. I know I’d certainly buy a copy.

Forgotten Unix Tricks?

I’ve been using differing flavours of Unix for almost 20 years now and have a fine appreciation for the power of the humble command-line (often from a DOS perspective too). It’s no wonder then, that I was drawn to this excellent post entitled, Stupid Unix Tricks?.

It’s a full-on geek fest of clever *nix tips and tricks and is anything but stupid (as the poorly named article suggests). If you have even the remotest passing interesting in the Unix operating system, be sure to check it out – there’s something in there for everyone.

Source: SlashDot

Making scripts executable inside Subversion

The Problem

Every time you check out a script file from Subversion on a Unix system, the file is missing the execute permission and you have to manually perform a chmod +x every time. This usually happens if the file was either originally added without the permission set or if it was added to Subversion from a Windows system. But more to the point, it is extremely annoying.

The Solution

The solution to this involves adding an internal Subversion property called svn:executable to the script file(s) in question. The property can either be set using Tortoise SVN from a Windows system (as described by a posting on Late Night PC found by my colleague Máté Rácz) or can be done from the command-line as follows:

$ svn propset svn:executable true

Both methods work and required a SVN commit afterwards.

Installing Nagios on Solaris

If you are not familiar with it, Nagios is an open source system and network monitoring application that keeps a watchful eye on hosts and services that you specify, alerting you when things go bad and when they get better. It was designed to run under Linux but, according to the creators, should also run on other Unix variants. With this in mind, I decided to try it out on Solaris.

Fortunately, they provide a very comprehensive User Guide and trust me, you’re going to need it. Suffice it to say, there is a section early in this document entitled Advice for Beginners which is pretty blunt about how tricky Nagios is to set up and, believe me, they are not wrong. Having said that, they do also say that once you get it running you will never want to be without it and I can definitely subscribe this this notion too.
Anyway, here are my notes from installing Nagios on Solaris:

My Setup

  • Solaris 10 (u3) for x86
  • Sun Studio 12
  • Nagios 2.10
  • Nagios Plugins 1.4.11

Building Nagios

I downloaded the Nagios source tar ball and unpacked it as a non-root user. Then, following the User Guide, I ran the configure script with no argument (implying I wanted all default settings) followed make all and this seemed to work fine.

Building Nagios Plugins

Nagios does most things by using other scripts/applications which it calls plugins. The Nagios website provides a collection of popular plugins for you to build. Once again, I did so using a configure command followed by a make all command. However, this did not go entirely smoothly:

  1. A number of the plugins failed to build citing an “undefined symbol: floor” error. This was resolved by adding -lm to the LIBS defined in line 328 of nagios-plugins-1.4.11/plugins/Makefile. This could probably also have been fixed by adding $(MATHLIBS) to the links statement of the affected plugins but that would have been more work.
  2. The check_dhcp module failed to compile citing several unknown data types (i.e. u_int8_t and u_int32_t). This was resolved by adding a -D__solaris__ to CPPFLAGS definitions at line 161 of nagios-plugins-1.4.11/plugins-root/Makefile
  3. The nagios-plugins-1.4.11/plugins-root/Makefile was also missing the same -lm link parameter as the plugins Makefile (line 221)

Once all of the above changes were make, all of the plugins seemed to build correctly.

Problems Found During Nagios Configuration

1. check_ping plugin did not work

No matter what way I configured the use of the check_ping plugin (in localhost.cfg, services section) it always reported:

CRITICAL – You need more args!!!
Could not open pipe:

A number of websites suggested that this was an IPv6 issue and that I should have used the --with-ipv6=no in my original call to the configure script when building the plugins. However, this was not the solution for me. It turns out that the definition of PING_COMMAND in nagios-plugins-1.4.11/config.h was empty and thus the check_ping plugin was actually making no attempt whatsoever to ping the requested host. I suspect that the reason for this is that I built the software as a non-root user which, on Solaris, does not have the ping command in it’s path (since ping is located in /usr/sbin on Solaris). Hence, the original configure script was unable to produce a valid definition for PING_COMMAND.

The solution to this was to edit nagios-plugins-1.4.11/config.h and add the following definition for PING_COMMAND (line 796)

#define PING_COMMAND “/usr/sbin/ping -s %s 64 %u”

The above command specific to Solaris and makes the Solaris version of ping behave like the Linux ping command. After this edit, I had to force a rebuild of the check_ping plugin (touch plugins/check_ping.c; make)

2. statusmap.cgi did not build

I only noticed this when I tried to view the Status Map section of Nagios. In short, the reason why this has not built is that I was missing a GD library on my Solaris system. The solution was to download and install a version of the GD library (and each of its dependent packages). I got mine from The statusmap.cgi utility then built correctly and once I copied it to the libexec directory where Nagios was installed, it worked.

3. VRML Browser Plugin required

When I tried to view the 3-D Status Map options in Nagios, my brower kept launching a “Save As” dialog box. I turns out I needed to install a VRML plugin in my browser. I chose one called Cortona from Parallel Graphics. It seems to work fine in Firefox although, as yet, the 3-D Status Map view is more impressive than it is useful (for me anyway).


Nagios indeed took a long time to install, configure and set up. However, I can confirm that it was worth the effort and I am very pleased with it so far.

MySQL Proxy Gotcha on Solaris SPARC

The Problem

During a recent install of MySQL Proxy on a Solaris 10 system (sparc u3), we encountered the following error whenever we supplied the --pid-file command-line argument:

Conversion from character set ‘646’ to ‘UTF-8’ is not supported

However, if we omitted the --pid-file argument, it worked just fine.
The Solution
Running ldd against the application revealed no missing libraries but when we ran it with truss, we discovered that it was indeed missing some library files:

open64("/export/home/mysqldev/mysql-proxy-32bit/inst/glib/lib/charset.alias", O_RDONLY) Err#2 ENOENT
access("/usr/lib/iconv/geniconvtbl/binarytables/", R_OK) Err#2 ENOENT
access("/usr/lib/iconv/", R_OK) Err#2 ENOENT
open("/usr/lib/iconv/alias", O_RDONLY) Err#2 ENOENT

It turns out that the Solaris system we were using was originally installed using the Core System cluster (SUNWCreq) and did not have all the requisite Unicode packages installed. So, an installation of the SUNWuiu8 package (from the Solaris distribution media) duly resolved the matter.

Renaming a Solaris system

I’ve had to change the hostname of a number of Solaris systems over the past few weeks, some of which were (sparse) Solaris zones. Here are some notes for my/your future reference:

File Global Zones Non-Global Zones
/etc/nodename Yes Yes
/etc/hostname.ifname Yes No
/etc/hosts Yes Yes
/etc/inet/hosts Yes Yes
/etc/inet/ipnodes Yes Yes


  1. You will need to replace the ifname above with the name of the appropriate interface on your system.
  2. Depending on your system configuration, I may of course be missing some files. However, the above worked for me!
  3. None of the systems in question were running IPv6