Please see this


Contents

- INDEX
- HP-UX Index
- Solaris
- Linux Index
- Other Unix types
- General Unix
- Unix Networking
- Unix Scripts
- Unix databases

Associated Information

- Unix Scripts Tips

Useful Links

- Bash shell HOWTO
- Bourne Shell Man Page
- C Shell Guide
- Korn Shell Resources

example

#! /bin/ksh # # @(#) Revision: 4.2.2 Date: 07/05/98 # ########################################################################## # # NO WARRANTIES OF ANY KIND ARE EXPRESSED OR IMPLIED FOR THE USE # OF THIS SCRIPT OR THE SUITABLITY OF THE INFORMATION COLLECTED # FOR ANY PURPOSE. # ########################################################################## # # This script may be distributed freely however, it is not to be used # for commercial purposes without the consent of the author. # eMail sean@hhinsight.com for information # ########################################################################## # # This script collects system configuration information for Hewlett # Packard 9000/800/700 series servers running HP-UX 10.x. # It also works reasonably well for 9.x though some of the additional # functionality was not configured or tested for 9.x. -Caveat Emptor- # This script must be run as root and should be run when the system is # quiet. # ########################################################################## # # Revision History # # 05/11/98 Updated to comply with current O/S -wsh # Added revision history -wsh # Modified default output to /tmp/<hostname>.collect -wsh # # 05/12/98 Added processor speed detection -wsh # Added additional functionality -wsh # # 05/13/98 Removed page breaks and superflous blank space -wsh # Fixed "empty file" error -wsh # Added additional functionality -wsh # Added test for NIS -wsh # Fixed "lanscan" duplicity -wsh # # 05/15/98 Corrected (some) 9.x command path errors and tests -wsh # Added test for sysmap fragmentation (panic) in HP-UX 10.20 -wsh # # 05/16/98 Added disk space summary -wsh # Added test for year2000.o (Y2K lib.c patch) -wsh # # 06/11/98 Version update, major changes -wsh # Added support for output options -wsh # Cleaned up comments -wsh # Re-worked tests and functions -wsh # Added additional funtionality and error checking -wsh # "tweaked" error checking & signal handling a bit more -wsh # # 06/12/98 Fixed bug in parsing lp options -wsh # Fixed bug in parsing file options (duh) -wsh # # 07/01/98 Added calculation for physical memory -wsh # # 07/03/98 Trimmed redundant information -wsh # Modified allocated disk space calculation -wsh # # 07/05/98 Cleanup, cleanup, cleanup -wsh # Added physical disk space calculation -wsh # Changed file listing(s) for quicker customization -wsh # Added Summary mode (-s) -wsh # ################################################################### # DEFINE FUNCTIONS ################################################################### ################################################################### # Clean up temporary files ################################################################### # clean () { # if [[ -a $outfile ]]; then rm $outfile 2> /dev/null fi tmpfile=/tmp/collect.tmp tmpfile1=/tmp/collect1.tmp if [[ -a $tmpfile ]]; then rm $tmpfile 2> /dev/null fi echo } # ################################################################### # Defines the interactive menu ################################################################### # report_menu () # { while true do clear echo echo "\t\t1. Tape device" echo "\t\t2. eMail to a user" echo "\t\t3. Printer" echo "\t\t4. Named file" echo "\n\t\tSelect an output option or [q]uit ==> \c" read selection case $selection in 1) echo "Tape Option" sleep 2 ;; 2) echo "eMail Option" sleep 2 ;; 3) echo "Printer Option" sleep 2 ;; 4) echo "Named file Option" sleep 2 ;; [Qq]*) break ;; *) echo "\a\a\a\n\n\tInvalid selection, please select 1-4 or [q]uit" sleep 2 continue ;; esac done } # ########################################################################## # HOLD SECTION FOR MODS ########################################################################## # # # # # # # # # # # ########################################################################## # List kernel information. ########################################################################## # kernel_info () # { echo "\nKernel Information\n" >> $outfile if [ -x /usr/contrib/bin/prconf ]; then echo "System Parameters\n" >> $outfile /usr/contrib/bin/prconf | pr -t -o5 >> $outfile fi if [ $type = 7 -o $type = 8 ]; then echo "Configured System Drivers\n" >> $outfile /etc/lsdev | pr -t -o5 >> $outfile echo >> $outfile fi if [ $rev -ge 10 -o $type = 8 ];then echo "System Parameters\n" >> $outfile /usr/sbin/sysdef >> $outfile echo >> $outfile fi log=/tmp/update.log if [ -f $log ]; then echo "Configuration Files\n" >> $outfile size=`ll $log | awk '{ print $5 }'` if [ $size -gt 5000 ]; then n=`grep -n "BEGINNING UPDATE PROGRAM" $log | tail -1 | cut -d: -f1` echo "Update Log\n" >> $outfile tail -n +$n $log | pr -t -o5 >> $outfile else echo "No update log found.\n" fi fi } # ########################################################################## # Get swap information ########################################################################## # swap_info () # { if [ $rev -ge 9 -a \( $type = 8 -o $type = 7 \) ]; then echo "Swap Information\n" >> $outfile /etc/swapinfo -mt | pr -t -o5 >> $outfile fi if [ $rev -ge 8 -a $type = 8 ]; then if [ -x /usr/contrib/bin/swapinfo ]; then echo "Swap Information\n" >> $outfile /usr/contrib/bin/swapinfo | pr -t -o5 >> $outfile fi fi echo >> $outfile } # ########################################################################## # Lists the contents of the specified network files. ########################################################################## # net_files () # { echo "Network Files\n" >> $outfile netfiles="" ###################################### # Input list of files here. ###################################### for netfiles in `cat <<EOF /etc/inetd.conf /etc/services /etc/protocols /etc/resolv.conf /etc/exports /etc/nsswitch.conf /etc/named.boot EOF` do if [ -f $netfiles ]; then echo "Contents of: $netfiles\n" >> $outfile cat $netfiles | pr -t -o5 >> $outfile >> $1 echo >> $outfile else echo "NOTE:\n\t$netfiles not found.\n" >> $outfile fi done make_end Network Files >> $outfile } # ########################################################################## # Lists the contents of the specified system files. ########################################################################## # list_files () # { file_name="" ###################################### # Input list of files here. ###################################### echo "System Files\n" >> $outfile for file_name in `cat <<EOF /etc/inittab /etc/fstab /etc/profile /etc/PATH /etc/MANPATH /etc/shells EOF` do if [ -f $file_name ]; then echo "Contents of: $file_name\n" >> $outfile pr -t -o5 /$file_name >> $outfile echo >> $outfile else echo "NOTE:\n\t$file_name not found.\n" >> $outfile fi done } # ########################################################################## # Lists the contents of the specified security files. ########################################################################## # secur_files () # { echo "Security Files\n" >> $outfile secfiles="" ###################################### # Input list of files here. ###################################### for secfiles in `cat <<EOF /etc/hosts.equiv /usr/adm/inetd.sec ~root/.rhosts /etc/ftpusers /var/adm/cron/at.allow /var/adm/cron/cron.allow EOF` do if [ -f $secfiles ]; then echo "Contents of: $secfiles\n" >> $outfile pr -t $secfiles >> $outfile echo >> $outfile fi done } # ########################################################################## # Get io config from kernel ########################################################################## # io_config () # { echo "IO Information\n" >> $outfile if [ $rev -ge 8 -a $type = 8 ] || [ $rev -ge 10 ]; then echo "Hardware Scan (usable)\n" >> $outfile echo >> $outfile /etc/ioscan -fu | pr -t -o5 >> $outfile echo >> $outfile echo "Kernel Scan\n" >> $outfile /etc/ioscan -k | pr -t -o5 >> $outfile echo >> $outfile else if [ -x /usr/contrib/bin/io ]; then echo "Kernel Scan\n" >> $outfile /usr/contrib/bin/io | pr -t -o5 >> $outfile fi if [ -x /usr/contrib/bin/spuscan ]; then echo "Hardware Scan\n" >> $outfile /usr/contrib/bin/spuscan | pr -t -o5 >> $outfile fi fi make_end IO Info >> $outfile } # ########################################################################## # Get startup/shutdown info ########################################################################## # start_info () # { echo "Startup/Shutdown Information\n" >> $outfile echo "RC Files\n" >> $outfile if [ $rev -ge 10 ]; then what /sbin/rc >> $outfile echo >> $outfile echo "Contents of: /sbin/init.d" echo >> $outfile ls -C /sbin/init.d >> $outfile echo >> $outfile for dir in `ls -d /sbin/rc*.d/` do echo "Contents of: $dir" >> $outfile echo >> $outfile ls -C $dir >> $outfile echo >> $outfile done else pr -t -o5 /etc/rc >> $outfile fi } # ########################################################################## # Gets disk drive information for Series 800 systems. ########################################################################## # diskinfo8 () # { for devname in `ls /dev/rdsk`; do if [ -c /dev/rdsk/$devname ]; then /etc/diskinfo /dev/rdsk/$devname 1>>${outfile} 2>/dev/null echo >> $outfile else echo "No information available for: "$devname >> $outfile echo >> $outfile fi echo done } # ########################################################################## # Get disk information. ########################################################################## # get_disk () # { if [ $rev -ge 9 ]; then echo "Bootable Logical Volumes:" >> $outfile echo >> $outfile lvlnboot -v 2>&1 >> $outfile echo "Volume Group Display:" >> $outfile echo >> $outfile vgdisplay -v 1>> ${outfile} 2>/dev/null >> $outfile echo "Logical Volume Display:" >> $outfile echo >> $outfile ( for lvname in `/etc/vgdisplay -v 2>/dev/null| grep "LV Name" | awk '{ print $3 }'`;do /etc/lvdisplay -v $lvname |sed '/Logical extents/,$d' done echo "\nPhysical Volume Display:" >> $outfile echo >> $outfile for pvname in `/etc/vgdisplay -v 2>/dev/null | grep "PV Name" | awk '{ print $3 }'`;do /etc/pvdisplay -v $pvname > $tmpfile cat $tmpfile | sed '/Physical extents/,$d' echo "Logical Volume PE Offset" cat $tmpfile | sed '1,/PE Status/d' | sed '$d' | find_pe_offsets echo done echo >> $outfile echo "LVM Information\n" >> $outfile ) | pr -t -o5 1>> $outfile 2>/dev/null fi } # ########################################################################## # Display device file information ########################################################################## # device_files () # { echo "Device Files\n" >> $outfile if [ $type = 8 ] || [ $rev -ge 10 ]; then if [ $rev -lt 8 ]; then rm $tmpfile 2> /dev/null for name in `find /dev \( -type c -o -type b \) -print `; do /etc/lssf $name >> $tmpfile 2> /dev/null done echo "All Devices\n" >> $outfile sort $tmpfile | pr -t -o5 >> $outfile else /etc/ioscan -fn | pr -t -o5 >> $outfile fi fi } # ########################################################################## # Gets network information. ########################################################################## # netinfo () # { echo "Network Information\n" >> $outfile echo "Host \c" >> $outfile nslookup `hostname` | sed -n '/Aliases/,/$/p' >> $outfile echo >> $outfile echo "Automount Status\n" >> $outfile grep -q AUTOMOUNT=1 /etc/rc.config.d/nfsconf if [[ $? = 0 ]]; then echo "\tAutomount is enabled\n" >> $outfile echo "\t`grep AUTO_MASTER= /etc/rc.config.d/nfsconf`\n" >> $outfile else echo "\tAutomount is not enabled\n" >> $outfile echo >> $outfile fi echo "DNS Status\n" >> $outfile if [[ -f /etc/named.boot ]]; then echo "\tDNS boot file found, listing named directory...\n" >> $outfile name_dir=`cat /etc/named.boot | grep directory | awk '{print $2}'` ls $name_dir >> $outfile echo >> $outfile else echo "\tDNS boot file not found\n" >> $outfile fi echo "NIS Status\n" >> $outfile /usr/bin/ypwhich > /dev/null 2>&1 if [[ $? = 0 ]]; then /usr/bin/ypwhich | pr -t -o5 >> $1 else echo "\tNIS is not configured" >> $outfile echo >> $outfile fi echo "Network Interface Status\n" >> $outfile /usr/bin/netstat -i | pr -t -o5 >> $1 echo >> $outfile echo "Network Memory Statistics\n" >> $outfile /usr/bin/netstat -m | pr -t -o5 >> $1 echo >> $outfile echo "Network Routing Tables\n" >> $outfile /usr/bin/netstat -rn | pr -t -o5 >> $1 echo >> $outfile echo "LAN Addresses\n" >> $outfile echo >> $outfile /etc/lanscan > $tmpfile /etc/lanscan >> $outfile echo >> $outfile lus=`cat $tmpfile | tail -n +3 | awk '{print $5}'` for lanlu in $lus; do /etc/ifconfig $lanlu >> $tmpfile1 done cat $tmpfile1 | pr -t -o5 >> $1 echo >> $outfile net_files >> $outfile rm $tmpfile 2> /dev/null rm $tmpfile1 2> /dev/null } # ########################################################################## # Gets software information. ########################################################################## # installed () # { echo "Listing software filesets..." if [ $rev -ge 10 ] then /usr/sbin/swlist -l product else /bin/ls -C /etc/filesets fi } # ########################################################################## # Calculates processor speed. ########################################################################## # speed () # { VERHPUX=`uname -r | cut -d"." -f2,3` case $VERHPUX in "09.04") NUM=`echo itick_per_usec/D | adb -k /hp-ux /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "09.05") NUM=`echo itick_per_usec/D | adb -k /hp-ux /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "09.07") NUM=`echo itick_per_usec/D | adb -k /hp-ux /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "10.00") NUM=`echo itick_per_usec/D | adb -k /hp-ux /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "10.01") NUM=`echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "10.10") NUM=`echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem | awk '{print $2}'| grep "[0-9]" `;; "10.20") NUM=`echo itick_per_usec/D | adb -k /stand/vmunix /dev/kmem | awk '{print $2}'| grep "[0-9]" `;; *);; esac echo "Processor Speed=$NUM Mhz \c" echo } # ########################################################################## # Calculates physical memory ########################################################################## # memory () # { VERHPUX=`uname -r | cut -d"." -f2` typeset -i pages pages=0 if [[ $VERHPUX != 10 ]]; then pages=`echo physmem /D | adb -k /hp-ux /dev/mem | awk '{print $2}'` else pages=`echo physmem /D | adb -k /stand/vmunix /dev/mem | awk '{print $2}'` fi mem=`bc << EOF $pages*4/1024 EOF` echo "Total physical memory is" $mem"Mb" } # ########################################################################## # Checks for superpage panic in HP-UX 10.20 ########################################################################## # sysmap_frag () # { VERHPUX=`uname -r | cut -d"." -f2,3` if [[ $VERHPUX = 10.20 ]]; then echo cpu_has_var_size_pages/D | adb /stand/vmunix /dev/kmem | grep 1 > /dev/null 2>&1 if [[ $? = 0 ]]; then echo " This system uses super pages and may be suceptable to a panic, check for the current current version of the following patches;\n \tPHKL_14686\n \tPHCO_12923\n \tPHCO_14628\n \tPHNE_14271\n \tPHKL_12340\n" >> $outfile else echo "This system does not use super pages." >> $outfile fi fi } # ########################################################################## # Calculates total disk space. ########################################################################## # disk_total () # { VERHPUX=`uname -r | cut -d"." -f2` if [[ $VERHPUX != 10 ]]; then section="*s2" else section="*d0" fi typeset -i total size size=0 total=0 echo "\nThe following disks were found...\n" for i in `ls /dev/rdsk/$section` do size=`diskinfo $i 2> /dev/null | grep size | awk '{print $2}'` model=`diskinfo $i 2> /dev/null | grep product | awk '{print $3}'` vendor=`diskinfo $i 2> /dev/null | grep vendor | awk '{print $2}'` if [[ $vendor = TOSHIBA ]]; then echo "\t$i is a $vendor CDROM, ignored.\n" else total=`bc << EOF $total+$size EOF` device=`echo $i | cut -d"/" -f4` echo "\tThe $vendor $model disk at $device is $size bytes in size." fi done echo "\nTotal disk space reported is "$total" bytes.\n" } # ########################################################################## # Calculates allocated space utilization. ########################################################################## # space_alloc () # { typeset -i num used avail num=0 for i in `bdf | awk '{print $2}' | grep -v kbytes` do num=$num+$i done echo "Total allocated disk space is $num Kbytes" >> $outfile used=0 for i in `bdf | awk '{print $3}' | grep -v kbytes` do used=$used+$i done echo "Total disk space used from allocation is $used Kbytes" >> $outfile avail=0 for i in `bdf | awk '{print $4}' | grep -v kbytes` do avail=$avail+$i done echo "Total disk space available from allocation is $avail Kbytes" >> $outfile } # ########################################################################## # Finds Physical Extent offsets for each # Logical volume on a Physical Volume. ########################################################################## # find_pe_offsets() # { read pe status lv1 le printf %-20.20s%9.4s\\n $lv1 $pe while read pe status lv le; do if [ $status = "free" ]; then lv=free fi if [ $lv != $lv1 ]; then printf %-20.20s%9.4s\\n $lv $pe lv1=$lv fi done } # ########################################################################## # Banner. ########################################################################## # make_banner() # { echo \\n\\n echo " "$1 $2 \\n\\n banner $1 " $2"| pr -o5 -t } # ########################################################################## # Ender. ########################################################################## # make_end() # { echo \\n\\n echo "\t\t==============================End $1 $2==============================" echo \\n\\n } # ################################################################### # START THE SCRIPT ################################################################### ################################################################### # Check passed parameters ################################################################### if [[ $# = 0 || $1 != '-'[a-z] ]]; then echo "\nUsage: collect -o [tape|lp|mail|file] -q -s" echo "\t\t-o Specify output" echo "\t\t-q Quiet mode" echo "\t\t-s Summary mode\n" echo "Example:\c" echo "\tcollect -s -o lp laserjet" echo "\t\tsend summary mode output to print queue \"laserjet\"\n" exit 1 fi while getopts :o:qs options do case $options in o) output=$OPTARG ;; ## i) menu=yes;; q) mode=quiet;; s) mode=summary;; :) print "\a\a\a\n\tThe -o option requires an argument!\n" >&2 print "\tPlease enter tape | lp | mail | file\n" >&2 exit 1;; \?) print "\a\a\a\n\t$OPTARG is not a valid option!\n" >&2 echo "Usage: collect -o [tape|lp|mail|file] -q\n" exit 1;; esac done ################################################################### # Setup some paths and variables ################################################################### PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin:/etc ; export PATH rev=`/bin/uname -r | /usr/bin/cut -c3-7` type=`/bin/uname -m | /usr/bin/cut -c6` if [ $type = 3 ]; then type=4 fi if [[ $outfile = "" ]]; then outfile=/tmp/`hostname`.collect fi ################################################################### # Verifies "root" user, mode and sets traps. ################################################################### if [ `whoami` != 'root' ]; then echo "You must be root to run this script!" exit 1 fi if [[ $menu = yes ]]; then report_menu fi if [[ $mode = 'quiet' ]]; then outfile=/tmp/`hostname`.collect fi trap 'clean;exit 1' 1 2 15 ################################################################### # Parse the output option. ################################################################### case $output in tape) default=/dev/rmt/0m if [[ $# = 3 && $output = 'tape' ]] ; then dev=$3 echo "\nValidating tape: $dev ... \c" mt -t $dev rew >/dev/null 2>/dev/null if [ $? -eq 0 ] ; then echo OK. destination=$dev else echo "\n\nInvalid device specified, resetting to $default..." echo "\n\tContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=$default else exit 1 fi fi else echo "\nNo device specified, resetting to $default..." echo "\nEnter tape device ==> \c" read dev if [[ -n $dev ]]; then echo "\nValidating tape: $dev ... \c" mt -t $dev rew >/dev/null 2>/dev/null if [ $? -eq 0 ] ; then echo OK. destination=$dev else echo "\n\nInvalid device specified, resetting to $default..." echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=$default else exit 1 fi fi fi fi ;; lp) if [[ -n $LPDEST ]]; then default=$LPDEST else default=`cat /usr/spool/lp/default` ## destination=$default fi if [[ $# < 3 && $output = 'lp' ]] ; then echo "\n\tInput printer queue ==> \c" read queue if [[ -n $queue && -a /usr/spool/lp/interface/$queue ]]; then echo OK. echo "Queue set to $destination" destination=$queue else echo "\nInvalid printer specified, resetting queue to default..." echo "\nQueue set to $default" echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=$default else exit 1 fi fi elif [[ $# = 3 && $output = 'lp' ]]; then if [[ -a /usr/spool/lp/interface/$3 ]]; then destination=$3 else echo "Invalid printer specified, resetting queue..." echo "Queue set to $default" echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=$default else exit 1 fi fi fi ;; mail) if [[ $# = 3 && $output = 'mail' ]]; then echo "Validating mail destination: $3 ... \c" /usr/lib/sendmail -bv $3 > /dev/null if [ $? -eq 0 ]; then echo OK. destination=$3 else echo "\n\tThe default destination is root\n" echo "\t Input a new recipient ==> \c" read destination if [[ -n $destination ]]; then echo "Validating mail destination: $destination ... \c" /usr/lib/sendmail -bv $destination > /dev/null if [ $? -eq 0 ]; then echo OK. else echo "\n\tInvalid recipient specified" echo "\nContinue with default? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=root else exit 1 fi fi fi fi elif [[ $# < 3 ]]; then echo "\n\tThe default destination root\n" echo "\t Input a new recipient ==> \c" read destination if [[ -n $destination ]]; then echo "Validating mail destination: $destination ... \c" /usr/lib/sendmail -bv $destination > /dev/null if [ $? -eq 0 ]; then echo OK. else echo "\n\tNo recipient specified" echo "\nInvalid recipient... reset to root." echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then destination=root else exit 1 fi fi fi fi ;; file) if [[ $# < 3 && $output = 'file' ]]; then echo "\n\tThe default destination is /tmp/`hostname`.collect\n" echo "\t Input a new file name ==> \c" read destination if [[ -n $destination ]]; then outfile=$destination else echo "\n\tNo output file specified" echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then outfile=/tmp/`hostname`.collect else exit 1 fi fi else if [[ $# = 3 && $output = 'file' ]]; then outfile=$3 else echo "\n\tThe default destination is /tmp/`hostname`.collect\n" echo "\n\tNo output file specified" echo "\nContinue? Yes|No [yes] ==> \c" read ans if [[ $ans = [Yy]* || -z $ans ]]; then outfile=/tmp/`hostname`.collect else exit 1 fi fi fi ;; esac ########################################################################## # Initialize output file ########################################################################## echo "\nInitializing..." clean sleep 2 echo "Report created: `date`" > $outfile echo echo "Configuration for:\n" >> $outfile banner `eval hostname` >> $outfile ########################################################################## # Start system summary ########################################################################## if [[ $mode = summary ]]; then echo "\tSummary mode report\n" >> $outfile fi echo "Operating System is HP-UX version " ${rev} >> ${outfile} echo "Machine type is " `uname -m` >> ${outfile} echo "Determining processor speed..." speed >> $outfile echo "Calculating physical memory..." memory >> $outfile space_alloc >> $outfile sysmap_frag >> $outfile ls -l /usr/lib/year2000.o > /dev/null 2>&1 if [[ $? = 0 ]]; then echo "\n\tThis system has a Y2K lib.c patch applied\n" >> $outfile else echo "\n\tThis system does NOT have a Y2k lib.c patch applied\n" >> $outfile fi if [[ $mode = summary ]]; then echo "Collecting disk information..." echo "BDF\n" >> $outfile bdf | pr -t -o5 >> $outfile echo >> $outfile swap_info >> $outfile echo "Disk Information" >> $outfile disk_total >> $outfile echo "Probing IO configuration..." echo "IO Scan\n" >> $outfile ioscan -f >> $outfile echo >> $outfile echo "Retrieving Subsystem information..." echo "Spooler Configuration\n" >> $outfile lpstat -s | pr -t -o5 >> $outfile echo >> $outfile echo "Cleaning up temporary files...\c" if [[ -f $tmpfile ]]; then rm $tmpfile 2> /dev/null fi if [[ -f $tmpfile1 ]]; then rm $tmpfile1 2> /dev/null fi echo "...Done." echo "\nThe output file is $outfile" exit 0 fi ########################################################################## # Get general kernel information ########################################################################## echo "Reading system configuration..." kernel_info >> $outfile swap_info >> $outfile make_end Kernel Info >> $outfile ########################################################################## # Display IO information ########################################################################## echo "Probing IO configuration..." io_config >> $outfile ########################################################################## # Get files ########################################################################## echo "Gathering files..." list_files >> $outfile make_end System Files >> $outfile echo "Fileset Information\n" >> $outfile installed | pr -t -o5 >> $outfile make_end Fileset Info >> $outfile echo "Getting startup/shutdown information..." start_info >> $outfile make_end StartUp Files >> $outfile echo "Listing device files..." device_files >> $outfile make_end Device Files >> $outfile ########################################################################## # Disk and file system information ########################################################################## echo "Collecting disk information..." echo "Disk Information\n" >> $outfile echo "BDF\n" >> $outfile bdf | pr -t -o5 >> $outfile echo >> $outfile if [ -f /etc/mirrorrc ] ; then echo "Mirror Status\n" >> $outfile mirror -l | pr -t -o5 >> $outfile fi disk_total >> $outfile ## diskinfo8 >> $outfile get_disk >> $outfile make_end Disk Info >> $outfile ########################################################################## # Get Network information ########################################################################## if [ $rev -ge 8 ]; then echo "Getting Network information..." netinfo $outfile fi make_end Network Info >> $outfile ########################################################################## # Display Security files ########################################################################## echo "Locating security related files..." secur_files >> $outfile make_end Security Files >> $outfile ########################################################################## # List exported file systems ########################################################################## if [ -f /etc/exports ]; then echo "Exported File Systems\n" >> $outfile pr -t -o5 /etc/exports >> $outfile echo >> $outfile fi ########################################################################## # SUBSYSTEMS ########################################################################## ########################################################################## # Get subsystem info ########################################################################## echo "Retrieving Subsystem information..." echo "SubSystem Information\n" >> $outfile echo "Getting Spooler information..." echo "Spooler Configuration\n" >> $outfile lpstat -s | pr -t -o5 >> $outfile echo >> $outfile ########################################################################## # OpenSpool Information ########################################################################## if [ -x /usr/bin/npstat ]; then echo "OpenSpool Status\n" >> $outfile /usr/bin/npstat -E | pr -t -o5 >> $outfile fi if [ -x /usr/bin/npcshow ]; then echo "OpenSpool Configuration\n" >> $outfile /usr/bin/npcshow -E | pr -t -o5 >> $outfile fi ########################################################################## # Network printer information ########################################################################## echo "LAN Based Printers\n" >> $outfile ( n=`grep -cs hpnp /etc/bootptab` if [ $n -gt 0 ]; then echo "The /etc/bootptab is configured to support $n LAN based printers." echo \\n fi grep -q hpnp /usr/spool/lp/interface/* if [[ $? = 0 ]]; then echo "The following LAN based printers are configured into lp:\n" >> $outfile cd /usr/spool/lp/interface grep -ls hpnp * | pr -3 -a -d -o10 -t >> $outfile else echo "\tNo LAN based printers configured\n" >> $outfile fi echo >> $outfile ) ########################################################################## # DTC information ########################################################################## if [ -x /etc/dtclist ]; then for dtc in `/etc/dtclist -c`; do echo "DTC Configuration for: $dtc\n" >> $outfile /etc/dtclist -c $dtc | pr -t -o5 >> $outfile done fi if [ -f /etc/newconfig/ddfa/dp ]; then echo "DDFA/DP\n" >> $outfile pr -t /etc/newconfig/ddfa/dp >> $outfile fi ########################################################################## # Check for Glance ########################################################################## echo "Performance Monitoring\n" >> $outfile if [[ $rev -ge 9 ]] && [[ -x /usr/perf/bin/glance ]] || [[ $rev -ge 10 ]] && [[ -x /opt/perf/bin/glance ]]; then echo "\tGlance is installed.\n" >> $outfile else echo "\tGlance is not installed.\n" >> $outfile fi ########################################################################## # NCS broker information ########################################################################## if [ -x /usr/sbin/ncs/lb_admin ]; then echo "NCS Location Broker Information\n" >> $outfile /usr/sbin/ncs/lb_admin <<EOF | pr -t -o5 >> $outfile lookup * * * quit EOF echo >> $outfile fi ########################################################################## # Sendmail information ########################################################################## if [[ $rev -ge 10 ]]; then smfile=/etc/mail/sendmail.cf smorig=/usr/newconfig/etc/mail/sendmail.cf else smfile=/usr/lib/sendmail.cf smorig=/etc/newconfig/sendmail.cf fi echo "Sendmail Configuration File Status\n" >> $outfile if [ -x /usr/lib/sendmail ]; then if [ -f $smfile -a -f $smorig ]; then diff -bwt $smfile $smorig >/dev/null 2>&1 (case $? in 0) echo "\nThe $smfile is the same as the original:\n\t$smorig." ;; 1) echo "Sendmail.cf customizations:\n" >> $outfile diff -bwt $smfile $smorig ;; *) echo "\n\nThere is a problem with the $smfile file." ;; esac) | pr -t -o5 >> $outfile fi echo >> $outfile echo "Sendmail Aliases\n" >> $outfile cat /usr/lib/aliases | pr -t -o5 >> $outfile >> $outfile fi ########################################################################## # ServiceGuard information ########################################################################## if [ -f /etc/cmcluster/cmclconfig.ascii ]; then echo "MC Service Guard Configuration\n" >> $outfile pr -t -o5 /etc/cmcluster/cmclconfig.ascii >> $outfile fi ########################################################################## # Crontabs ########################################################################## if [[ $rev -ge 10 ]] && [[ -d /var/spool/cron/crontabs ]]; then for cron_tab in `ls /var/spool/cron/crontabs` do echo "\nCrontabs:\n" >> $outfile echo "Contents of "$cron_tab"'s crontab:\n" >> $outfile cat /var/spool/cron/crontabs/$cron_tab >> $outfile done else for cron_tab in `ls /usr/spool/cron/crontabs` do echo "Contents of "$cron_tab"'s crontab:\n" >> $outfile cat /usr/spool/cron/crontabs/$cron_tab >> $outfile done fi make_end Subsys Info >> $outfile ########################################################################## # Clean up ########################################################################## echo "Cleaning up temporary files...\c" if [[ -f $tmpfile ]]; then rm $tmpfile 2> /dev/null fi if [[ -f $tmpfile1 ]]; then rm $tmpfile1 2> /dev/null fi echo "...Done." echo "\nThe output file is $outfile" ################################################################### # Process the output options ################################################################### case $output in tape) outname=`basename $outfile` tar -cv$destination -C /tmp $outname echo "The system documentation has been tar'ed to:" $destination echo "\n\tA copy of the documentation is in: $outfile\n" ;; lp) lp -d$destination $outfile echo "The system documentation has been spooled to:" $destination echo "\n\tA copy of the documentation is in: $outfile\n" ;; mail) mailx -s "System Snapshot" $destination < $outfile echo "The system documentation has been mailed to:" $destination echo "\n\tA copy of the documentation is in: $outfile\n" ;; file) echo "\n\tA copy of the documentation is in: $outfile\n" ;; esac #### END OF SCRIPT

Copyright 2000 Intronet Computers Ltd
Email: Intronet Computers for enquiries