Tuesday, September 23, 2008

Find Your Version of glibc

This is how you can find the version of glibc installed on your Linux machine:
sharfah@starship:~> rpm -q glibc

Thursday, September 04, 2008

Howto: Sign Automated Emails [Unix]

As part of my work, I sometimes have to write scripts which email information out. For example, I have a script which periodically checks disk usage using the df command and emails an alert if greater than 90%. Other scripts query databases using isql or sqlplus and email reports to users. It is very useful to have these emails "signed" by the script, so that you can easily identify which script sent the email.

All of my scripts contain a sign function which simply prints out the hostname and the full name of the script being executed. Here is an example of it in action:


#print out the host and script
    echo "-- "
    echo `hostname`:`pwd`/$0

#create email
echo "This is a test email" > $MAILFILE

#sign it
sign >> $MAILFILE

mailx -s "$SUBJECT" "$TO" < $MAILFILE

Tuesday, September 02, 2008

How to Find Your Solaris Version

If you are developing an application which runs on Solaris, you may need to know which version of Solaris it is, so that you can use the correct JRE build, Sybase libraries etc.

You can do this using the uname command which prints out useful system information. In order to get just the version number (release level) use the -r flag:

sharfah@starship:~> uname -r
OS_VERSION=`uname -r`

if [ "$OS" = "SunOS" ]
elif [ "$OS" = "Linux" ]
 echo "Unknown operating system $OS"
If you want more details on your Solaris version, look at /etc/release.
sharfah@starship:~> cat /etc/release
                        Solaris 10 8/07 s10x_u4wos_12b X86
           Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                            Assembled 16 August 2007