Technical article 110291

How do I gather a lot of important information about my OpenServer 5 system, for troubleshooting purposes, with a single command?

OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7

Written · Last revised

Problem

How, as a Support Engineer or customer troubleshooting a problem on
an SCO OpenServer 5 system, can I produce a lot of generally useful
system information with a single command?  A shell script that runs
a collection of useful commands and saves the output for later
analysis would be extremely helpful.

Solution

The shell script included below can be run on any SCO OpenServer 5
system to gather such useful information.  The script works in two
stages:

(1) It performs a non-disruptive, system dump of live memory if the shell variable CAPTURE_DUMP is set to the value "Y"; CAPTURE_DUMP is set to "N" by default.

(2) It performs a collection of generically useful commands such as "swconfig", "hwconfig", "netstat (various options)", "brand -L", and many others, saving all output to a file.

The files generated by the script as described above are given
obviously suggestive names; all files contain the label-prefix
<system-name>-<date>.  The files are compressed, and archived
into a tar file named <system-name>-<date>.tar.
It may be convenient to use this script as a template for
customization, according to individual needs.  For instance,
between the lines:
done << ==end-of-info-commands==
and:
==end-of-info-commands==

you may insert additional commands of your own choosing to generate other useful output.

NOTE:

Some utilities run by the script, most notably "lsof" and "sockinfo", are not furnished by the OpenServer 5 product. These particular tools are furnished by the following two TLSs (Technical Library Supplements): tls615 (lsof), and tls604 (Network Security Tools Ver 2.4).

If your system does not currently have a few of the commands included in the script by default, you may still run the script. The <system-name>-<date>.info file will simply contain:

<command name>: not found

instead of the usual output from these particular commands.

####################<<<<<<<BEGIN SCRIPT>>>>>>>######################
#!/bin/sh
#
# This script captures a wide variety of information about the system
# under test, to aid in debugging.  Optionally, it also captures a live
# system dump image.
#
##############
CAPTURE_DUMP=N         # change to N if a live system dump is not desired
##############
if [ ! -w /dev/mem ]; then
echo "This script requires root privileges." 1>&2
exit 1
fi
FILES=
NAME=`uname -n`-`date +%Y-%m-%d+%H:%M`
case $CAPTURE_DUMP in
Y*) case "`type sysdump`" in
*"not found"*) echo '`sysdump` not found (usually /etc/sysdump); cannot capture
a live system dump.
 `sysdump` was newly introduced in OpenServer Release 5.0.4.  The
binary (/etc/sysdump) works on earlier releases as well.' 1>&2
;;
*) sysdump -i /dev/mem -buf -o - 2> $NAME.sysdump-output |
compress -H > $NAME.live-dump.Z
FILES="$FILES $NAME.live-dump.Z $NAME.sysdump-output"
;;
esac
;;
esac
{
while read line; do
skip=0
set -- $line
case "`type $1`" in
*"not found"*) skip=1;;
esac
for arg in "$@"; do
case $arg in
/*) if [ ! -f $arg ]; then skip=1; fi
esac
done
if [ $skip = 0 ]; then
echo "==================== $line ===================="
eval $line 2>&1
fi
done << ==end-of-info-commands==
date
uptime
uname -a
uname -X
ps -elf
lsof -n
brand -L
hwconfig -h
hw -v
swconfig
displaypkg
pkglist
netconfig -s
ifconfig -a
netstat -ni
netstat -s
ndstat -l
netstat -na
sockinfo -a
ss
netstat -nr
netstat -ma
cat /etc/conf/cf.d/mtune
cat /etc/conf/cf.d/stune
cat /etc/conf/cf.d/mdevice
cat /etc/conf/cf.d/sdevice
cat /etc/conf/cf.d/mevent
cat /etc/conf/cf.d/sevent
# Make sure there are no leading spaces on the next line
==end-of-info-commands==
} | compress -H > $NAME.info.Z
FILES="$FILES $NAME.info.Z"
tar cf $NAME.tar $FILES
rm -f $FILES
####################<<<<<<<END SCRIPT>>>>>>>######################

Alternatively, simply download and install the latest version of our own System Information Gathering Tool (sysinfo) available from

http://www.sco.com/support/download.html

From the Xinuos technical article database, record 110291. Reproduced with permission. The original is at www.sco.com/ta/110291, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.