Category Archives: Languages and Scripting

Glance adviser scripts

The first most important thing in proactive performance tuning is to establish a baseline. This can be done by capturing performance data at normal operation. If you are familiar with the interactive glance, and want to have the output in that familiar format, you can automate data collecting with adviser scripts and have the output [...]

Find out the disk we were booted from – Itanium version

This is an advanced method to determine which disks we were booted from. I already posted a solution here, but it turned out to work only for PA-RISC systems. If you are on Itanium, it is more complicated. With adb on /stand/vmunix it only provides you the minor number of the disk in question. Since [...]

Working with configuration files

Not many people knows about the HP-UX tool ch_rc. This is a command line tool for people who are not so familiar with sed (stream editor), awk and pattern matching. SYNOPSIS /usr/sbin/ch_rc -a|-r|-l [-v] [-A] [-R root] [-p {parameter|parameter=value}...] [file...] If you want to query a variable in one of a config file under /etc/rc.config.d, [...]

Running a cronjob on the last day of the month

Although in cron one doesn’t have the ability to specify the last day of the month (for e.g. generating monthly reports) one can easily achieve it with this workaround. Now I show you the idea: This is today: # date +’%d’

Variable sizes in KSH

It looks like the POSIX shell doesn’t support variable sizes greater than 2 Gigabytes. In the following example, the LIMIT variable is of 1 Gbyte, and the VALUE is 4 GBytes. # LIMIT=1073741824 # VALUE=4294967296 # if [ $LIMIT -lt $VALUE ] > then > echo “exceeds limit” > else > echo “passed” > fi [...]

UNIX95 variable influences to the ps command

Setting UNIX95 to some value (it doesn’t matter what it is) changes the behavior of the ps command to use the XPG4 environment instead of the HPUX environment. You can see all the different command line options and the XPG4 behaviors by looking at the man pages (e.g. man ps). Several options like ps -o [...]

Real-time ethernet bandwidth utilisation

Some weeks ago one of my colleagues asked me how could he monitor the traffic rate of the ethernet network. There is the netperf tool which you can get from the porting center, however that is more of a network troubleshooter tool than a real-time monitoring software. Now I found a nice perl script which [...]

Advanced scripting – changing the UID of a user

At one of our customer we will have an monstre’ UID-consolidation projekt in the near future. For this purpose I’ve written a script to enlighten our task. Most of you thinks at it a an over-complicated (usermod && find …. chown …) job, but my script has undergone some performance optimisation too: it starts parallel [...]

Differences between shells

Here is a comparison matrix I’ve found on www.faqs.org: sh csh ksh bash tcsh zsh rc es Job control N Y Y Y Y Y N N Aliases N Y Y Y Y Y N N Shell functions Y(1) N Y Y N Y Y Y “Sensible” Input/Output redirection Y N Y Y N Y [...]

Comparing two files

There is the well-known diff command, but besides this there are at least two more ways to compare the contents of files.