#!/bin/sh
export VERSION="2.16.84"
#
##############################################################################
# Script for collecting key information to identify system makeup.           #
# This script will output a file HOSTNAME.date.supportinfo.tar.gz found in   #
# /var/tmp or the specified output directory.                                #
##############################################################################
# Copyright (c) 2011 Sherlock Services - Seamless Support                    #
# Written by Jamie Willard                                                   #
##############################################################################
# This program is the property of Sherlock Services, Inc. This is intended   #
# to be run as a licensed functional unit of Sherlock Services, Inc. and may #
# not be copied, reproduced, or used in any way without the consent of it's  #
# owner. Sherlock Services is not responsible for any damages incurred from  #
# the use of this script.                                                    #
##############################################################################
#
###default variable setup
export SYS="`/usr/bin/hostname`.`date "+%y%m%d_%H%M"`.supportinfo"
export SYS2=`/usr/bin/hostname`
export OUTDIR=/var/tmp
export WORKDIR=/tmp
export UNAM=`/usr/bin/whoami`
export PWD=`/usr/bin/pwd`
export RPATH=/var/tmp/supportinfo
export MAIL=0
export NOROOT=0
export ADB=0
export DEBUG=0
export RC=0
export ERRC=0
export ZIPNAME=zip
export ZIPFILE=${WORKDIR}/$SYS.$SECTION.$ZIPNAME.html
export ZF=0
export TF=0
export VAEX=0
export COMMANDL=`ps -ef|grep supportinfo |grep -v grep | cut -d " " -f 18-`
export HEADCOUNT=0
export SUBHEADCOUNT=0
export SECTIONCOUNT=0

###function setup
#

###display help and command syntax
#
help_file()
{
     echo " "
     echo "Usage:"
     echo "$0 [-h -c -ch -d -v -sm -nr -ns -adb -vaex] -od {path} -wd {path} -rcp {hostname} {directory}"
     echo " "
     echo "-help     | -h   =     show this help screen"
     echo "-cleanup  | -c   =     removes all supportinfo related files from outdir and workdir"
     echo "                       specify the outdir and workdir arguments if needed"
     echo "-chassis  | -ch  =     turn on chassis log collection"
     echo "-verbose  | -v   =     turn on verbose mode"
     echo "-sendmail | -sm  =     collect sendmail configuration"
     echo "-noroot   | -nr  =     exclude rootmail collection"
     echo "-noscan   | -ns  =     do not scan anything"
     echo "-adb             =     turn on the use of adb commands"
     echo "-outdir   | -od  =     use to specify the final output directory"
     echo "                       path = absolute local path"
     echo "                       default = /var/tmp"
     echo "-workdir  | -wd  =     use to specify the work directory"
     echo "                       path = absolute local path"
     echo "                       default = /tmp"
     echo "-vaex            =     collect extended Virtual Array Information"
     echo "-rcp             =     use to transfer output to remote system"
     echo "                       hostname = remote host name"
     echo "                       directory = absolute remote output path"
     echo " "
     echo "Jamie Willard"
     exit 1
}

###remove all temporary files from workdir
#
cleanup_workdir()
{
     test -f ${WORKDIR}/*.supportinfo.html
     if [ $? = 0 ] ; then
       rm ${WORKDIR}/*.supportinfo.html
     fi
     test -f ${WORKDIR}/$SYS.*.tar
     if [ $? = 0 ] ; then
       rm ${WORKDIR}/$SYS.*.tar
     fi     
     test -f ${WORKDIR}/$SYS.*.html.zip
     if [ $? = 0 ] ; then
       rm ${WORKDIR}/$SYS.*.html.zip
     fi         
     test -f ${WORKDIR}/*.supportinfo.*.html
     if [ $? = 0 ] ; then
       rm ${WORKDIR}/*.supportinfo.*.html
     fi
     test -d ${WORKDIR}/support
     if [ $? = 0 ] ; then 
       rm -R ${WORKDIR}/support
     fi
}

###remove all existing output files from outdir
#
cleanup_outdir()
{
     test -f ${OUTDIR}/*.supportinfo.tar.gz
     if [ $? = 0 ] ; then
          rm ${OUTDIR}/*.supportinfo.tar.gz
     fi
}

###remove section files from workdir
#
cleanup_section()
{
     test -f ${WORKDIR}/*.supportinfo.$SECTION.work.html
     if [ $? = 0 ] ; then
          rm ${WORKDIR}/*.supportinfo.$SECTION.work.html
     fi
     test -f ${WORKDIR}/*.supportinfo.$SECTION.head.html
     if [ $? = 0 ] ; then
          rm ${WORKDIR}/*.supportinfo.$SECTION.head.html
     fi
}

###create files for sections
#Args: section name
file_create()
{
     export SECTION=$1
     SECDATE=`date`
     HEADFILE=${WORKDIR}/$SYS.$SECTION.head.html
     touch $HEADFILE
     HEADCOUNT=0
     SUBHEADCOUNT=0
     SECTIONCOUNT=$(($SECTIONCOUNT + 1))
     # insert html header
     echo "<HTML><HEAD><TITLE>$SECTION - $SYS</TITLE></HEAD>"  >>$HEADFILE
     echo "<A NAME=_TOP></a>" >>$HEADFILE
     echo "\n<PRE>"  >>$HEADFILE
     banner `hostname` >>$HEADFILE
     echo " " >>$HEADFILE
     echo "Supportinfo Output: " >>$HEADFILE
     echo "Commandline:        " $COMMANDL >>$HEADFILE
     echo "Time Ran:           " $SECDATE >>$HEADFILE
     echo "Hostname:           " $SYS2 >>$HEADFILE
     echo "Script Version:     " $VERSION >>$HEADFILE
     echo "Working Directory:  " $WORKDIR >>$HEADFILE
     echo "Output Directory:   " $OUTDIR >>$HEADFILE
     echo "Directory Ran From: " $PWD >>$HEADFILE
     echo "User Ran By:        " $UNAM >>$HEADFILE
     echo "___________________________________________________________________________________________" >>$HEADFILE
     echo "--Creating:      $HEADFILE" >>$DEBUGFILE
     echo "                 $SECDATE" >>$DEBUGFILE
     #if [ "$DEBUG" = "1" ] ; then
     #  echo "--Creating:       $HEADFILE"
     #fi
     # create temp body doc
     WORKFILE=${WORKDIR}/$SYS.$SECTION.work.html
     #if [ "$DEBUG" = "1" ] ; then
     #  echo "--Creating:       $WORKFILE"
     #fi
     touch $WORKFILE
     
}

###close files for sections (concatenate header, body, footer)
#Args: section name
file_close()
{
     export SECTION=$1
     HEADFILE=${WORKDIR}/$SYS.$SECTION.head.html
     WORKFILE=${WORKDIR}/$SYS.$SECTION.work.html
     export SECTION=$1
     OUTFILE=${WORKDIR}/$SYS.$SECTION.html
     #if [ "$DEBUG" = "1" ] ; then
     #  echo "--Creating:       $OUTFILE"
     #fi
     echo "--Creating:       $OUTFILE" >>$DEBUGFILE
     touch $OUTFILE
     echo "___________________________________________________________________________________________" >>$HEADFILE
     # cat files together
     cat $HEADFILE $WORKFILE > $OUTFILE
     # html footer
     echo "</PRE>\n</BODY></HTML>" >> $OUTFILE
     echo "--Removing:       $HEADFILE" >>$DEBUGFILE
     echo "--Removing:       $WORKFILE" >>$DEBUGFILE
     #if [ "$DEBUG" = "1" ] ; then
     #  echo "--Removing:       $HEADFILE"
     #  echo "--Removing:       $WORKFILE"
     #fi
     cleanup_section
}

###capture and display verbose and debug info
#
command_debug()
{
export RETCOD=$?
if [ $RETCOD -ne 0 ] ; then
    echo "<<<Return Code = $RETCOD" >>$DEBUGFILE
    #increment error count
    ERRC=$(($ERRC + 1))
    echo " " >>$ERRORFILE
    echo "Command =   $COMMAND" >>$ERRORFILE
    echo "<<<Return Code = $RETCOD - Error Count = $ERRC" >>$ERRORFILE
    echo "Error output is above this line" >>$ERRORFILE
    echo "___________________________________________________________________________________________" >>$ERRORFILE
    echo " " >>$ERRORFILE
    echo "<<<Return Code = $RETCOD - Error Count = $ERRC" >>$WORKFILE
fi
}

###command_head
#Args: text to display
#
command_head()
{
export COMMAND=$1
export SUBHEADCOUNT=0
HEADCOUNT=$(($HEADCOUNT + 1))
COUT="$SECTIONCOUNT.$HEADCOUNT"
HEADCOUT="$COUT   - $COMMAND"
echo " >Starting:       $HEADCOUT" >>$DEBUGFILE
if [ "$DEBUG" = "1" ] ; then
     echo " >Starting:       $HEADCOUT"
fi

#add to index file
#echo "<A HREF="#_$COUT">$HEADCOUT</A>" >>$INDEFILE

#add to table of contents in head file
echo "<A HREF="#_$COUT">$HEADCOUT</A>" >>$HEADFILE
#add to work file
echo " " >>$WORKFILE
echo "<A NAME=_$COUT><BR><B><FONT COLOR=RED>$HEADCOUT</FONT></B>" >>$WORKFILE
echo "<A HREF="#_TOP">Go to Top</A>" >>$WORKFILE
echo ">>>>>> ************************************" >>$WORKFILE
}

###command_subhead
#Args: text to display
#
command_subhead()
{
export COMMAND=$1
SUBHEADCOUNT=$(($SUBHEADCOUNT + 1))
SCOUT="$SECTIONCOUNT.$HEADCOUNT.$SUBHEADCOUNT"
SUBHEADCOUT="$SCOUT - $COMMAND"
echo "  +Sending:       $COMMAND" >> $DEBUGFILE
if [ "$DEBUG" = "1" ] ; then
     echo "  +Sending:       $SUBHEADCOUT"
fi
#add to table of contents in head file
echo "<A HREF="#_$SCOUT">$SUBHEADCOUT</A>" >>$HEADFILE
echo " " >>$WORKFILE
echo "<A NAME=_$SCOUT><BR><B><FONT COLOR=RED>$SUBHEADCOUT</FONT></B>" >>$WORKFILE
echo "<A HREF="#_TOP">Go to Top</A>" >>$WORKFILE
echo ">>>>>> ____________________________________" >>$WORKFILE
}

###check for superuser access
check_root() 
{
        if [[ `id -u` != "0" ]]
        then
        echo "ERROR: You must have root access: `id -u` (Loginname: $UNAM)\n"
        exit 1
        fi
}

###check if already running
check_run()
{
        RUNRUN=$(ps -ef|grep "$0"|grep -v grep|grep -v $$|grep -v '^+^'|grep -v man)
        if [[ "$RUNRUN" != "" ]]
        then
         PID=$(echo ${RUNNING} | awk {"print \$2;exit"})
         echo "Supportinfo is already running under pid: $PID"
         exit 1
        fi
}
     
###command line arguments and options
while [ $# -ne 0 ]
do
   case $1 in
        -noscan | -ns)   #do NOT collect system info
                         NOSCAN=1
                             ;;
        -chassis | -ch)  #turn on chassis log collection
                         CHASSIS=1
                             ;;
        -adb)            #turn on adb commands
                         ADB=1
                             ;;
        -verbose | -v)   #turn on verbose mode
                         DEBUG=1
                             ;;
        -cleanup | -c)   #cleanup old output from OUTDIR and WORKDIR 
		                     CLEANUP=1
      	                     ;;
        -sendmail | -sm) #collect sendmail configuration
                         MAIL=1
                             ;;
        -noroot | -nr)   #dont collect rootmail
                         NOROOT=1
                             ;;
        -help | -h)      #command syntax and help
                         help_file
                         exit 1
                             ;;
        -outdir | -od)   #set directory to output
                         OUTDIR=$2
                         shift
                             ;;
        -vaex)           #capture extended Virtual Array information
                         VAEX=1
                             ;;
        -workdir | -wd)  #set directory to work in
                         WORKDIR=$2
                         shift
                             ;;
        -rcp)            #transfer final output to remote server
                         RCPO=1
                         RHOST=$2
                         RPATH=$3
                         shift
                         shift
                             ;;
        *)               #invalid command line arguments
                         echo " " >>$WORKFILE
                         echo "$0: $1 is an invalid option"
                         echo " " >>$WORKFILE
                         echo " " >>$WORKFILE
                         help_file
                         exit 1
                             ;;
   esac
   shift
done

check_root
check_run

if [ "$CLEANUP" = "1" ] ; then
   echo " "
   echo "Cleaning output directory:    "$OUTDIR     
     cleanup_outdir
   echo "Cleaning working directory:   "$WORKDIR
     cleanup_workdir
fi

cleanup_workdir

###display startup info to user
echo " "
echo "Collecting information on $SYS2 please wait"
echo "This process could take up to 10 minutes, please be patient."
echo "Supportinfo Output: "
echo "Commandline:        " $COMMANDL
echo "Date Ran:           " `date`
echo "Hostname:           " $SYS2
echo "Script Version:     " $VERSION
echo "Working Directory:  " $WORKDIR
echo "Output Directory:   " $OUTDIR
echo "Directory Ran From: " $PWD
echo "User Ran By:        " $UNAM

if [ "$NOSCAN" = "1" ]
then
     exit
fi
     
###update ioscan (use the k option after this to save time)
/usr/sbin/ioscan -fn > /dev/null

#################################
# Start creating separate files #
#################################

DEBUGFILE=${WORKDIR}/$SYS.debug.work.html
file_create debug
###########################
###########################
###########################
#file to store verbose output
###########################

file_create error
###########################
###########################
###########################
#file to store error output
ERRORFILE=${WORKDIR}/$SYS.error.work.html
###########################

file_create main
###########################
###########################
###########################
command_head "SYSTEM AND SOFTWARE INFORMATION FOR $SYS2"
###
command_subhead "uname -a"
/usr/bin/uname -a >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "model"
/usr/bin/model >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem"
if [ "$ADB" = "1" ] ; then
  echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "ADB Commands turned off" >>$WORKFILE
fi
###
command_subhead "getconf CPU_CHIP_TYPE"
echo "CPU Chip Type " `getconf CPU_CHIP_TYPE` >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "getconf KERNEL_BITS"
echo "O/S Bit is " `getconf KERNEL_BITS` >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "machinfo"
if [ -f /usr/contrib/bin/machinfo ] ; then
   /usr/contrib/bin/machinfo >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No machinfo file" >>$WORKFILE
fi
echo " " >>$WORKFILE

###
command_head "HARDWARE INFORMATION FOR $SYS2"
###
command_subhead "ioscan -fn"
/usr/sbin/ioscan -fnk >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "ioscan -fenN"
/usr/sbin/ioscan -fenNk >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_head "STM infolog for all devices"
# Check to see if diagmon is running.  If not, start it
DAEMON=0
ps -ef | grep diagmond | egrep -v grep >> /dev/null
if [ $? -eq 1 ]
  then
      /usr/sbin/stm/uut/bin/sys/diagmond 2>>$ERRORFILE
      command_debug
      # wait for diagmond to finish starting
      sleep 60
      DAEMON=1
fi
if [ -x /usr/sbin/cstm ] ; then
  echo 'selclass qualifier all;mop prodwidth 45;mop showstatus no;mop showtool no;map;info;wait;infolog' | /usr/sbin/cstm >>$WORKFILE 2>>$ERRORFILE
  command_debug
  echo " " >>$WORKFILE
else
  echo "CSTM information not available" >>$WORKFILE
  echo " " >>$WORKFILE
fi
# If diagmond was not running previously, then kill it
DIAGMOND=`ps -ef | grep diagmond | egrep -v grep | awk '{print $2}'`
if [ $DAEMON -eq 1 ]
   then
       kill $DIAGMOND
fi
echo " " >>$WORKFILE
###
command_subhead "strings /etc/shutdownlog"
strings /etc/shutdownlog >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "crontab -l"
crontab -l >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/PATH"
/usr/bin/cat /etc/PATH | tr ':' ' ' >>$WORKFILE 2>>$ERRORFILE
command_debug
###########################
file_close main

file_create array
###########################
###########################
###########################
#MOD12h
###
command_head "MOD12H ARRAYDSP INFO"
test -f ${WORKDIR}/arrays.supportinfo.html
if [ $? = 0 ] ; then
  rm ${WORKDIR}/arrays.supportinfo.html
fi
touch ${WORKDIR}/arrays.supportinfo.html
export ARRAY=0
if [ -x /opt/hparray/bin/arraydsp ] ; then
  ###
  command_subhead "arraydsp -i $ENC"
  /opt/hparray/bin/arraydsp -i >>$WORKFILE 2>>$ERRORFILE
  /opt/hparray/bin/arraydsp -i | grep with | awk '{print $4}' >>${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE
  command_debug
  export ARRAY=1
  echo " " >>$WORKFILE
else
  echo "No HP Disk Arrays to report" >>$WORKFILE
  echo " " >>$WORKFILE
fi
if [ $ARRAY != 0 ] ; then
  for ENC in `cat ${WORKDIR}/arrays.supportinfo.html`
  do
    ###
    command_subhead "arraydsp -a $ENC"
    /opt/hparray/bin/arraydsp -a $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraydsp -c $ENC"    
    /opt/hparray/bin/arraydsp -c $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraydsp -l $ENC"
    /opt/hparray/bin/arraydsp -l $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraydsp -d $ENC" 
    /opt/hparray/bin/arraydsp -d $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_head "ArrayLOG for Array $ENC"
    ###
    command_subhead "arraylog -u $ENC"
    /opt/hparray/bin/arraylog -u $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog -e $ENC"    
    /opt/hparray/bin/arraylog -e $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A1"     
    /opt/hparray/bin/arraylog -d A1 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B1"   
    /opt/hparray/bin/arraylog -d B1 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A2"     
    /opt/hparray/bin/arraylog -d A2 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B2"     
    /opt/hparray/bin/arraylog -d B2 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A3"         
    /opt/hparray/bin/arraylog -d A3 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B3"     
    /opt/hparray/bin/arraylog -d B3 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A4"     
    /opt/hparray/bin/arraylog -d A4 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B4"     
    /opt/hparray/bin/arraylog -d B4 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A5"     
    /opt/hparray/bin/arraylog -d A5 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B5"     
    /opt/hparray/bin/arraylog -d B5 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk A6"     
    /opt/hparray/bin/arraylog -d A6 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "arraylog $ENC Disk B6"     
    /opt/hparray/bin/arraylog -d B6 $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    echo " " >>$WORKFILE
  done
fi
rm ${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE

#FC60
###
command_head "FC60 AMDSP INFO"
test -f ${WORKDIR}/arrays.supportinfo.html
if [ $? = 0 ] ; then
  rm ${WORKDIR}/arrays.supportinfo.html
fi
touch ${WORKDIR}/arrays.supportinfo.html
export ARRAY=0
if [ -x /opt/hparray/bin/amdsp ] ; then
  /opt/hparray/bin/amdsp -i >>$WORKFILE 2>>$ERRORFILE
  /opt/hparray/bin/amdsp -i | grep "Array with" | awk '{print $4}' >>${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE
  command_debug
  export ARRAY=1
  echo " " >>$WORKFILE
else
  echo "No HP Disk Arrays to report" >>$WORKFILE
  echo " " >>$WORKFILE
fi
if [ $ARRAY != 0 ] ; then
  for ENC in `cat ${WORKDIR}/arrays.supportinfo.html`
  do
    ###
    command_subhead "amdsp -a $ENC"
    /opt/hparray/bin/amdsp -a $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "amdsp -c $ENC"
    /opt/hparray/bin/amdsp -c $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "amdsp -l $ENC"
    /opt/hparray/bin/amdsp -l $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "amdsp -d $ENC"
    /opt/hparray/bin/amdsp -d $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "amlog -t mel -c -a $ENC"
    /opt/hparray/bin/amlog -t mel -c -a $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
  done
fi
rm ${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE

#VA7x00 Series Arrays
###
command_head "VA7xx0"
test -f ${WORKDIR}/arrays.supportinfo.html
if [ $? = 0 ] ; then
  rm ${WORKDIR}/arrays.supportinfo.html
fi
touch ${WORKDIR}/arrays.supportinfo.html
export ARRAY=0
if [ -x /opt/sanmgr/commandview/client/sbin/armdsp ] ; then
  ###
  command_subhead "armdsp -i"
  /opt/sanmgr/commandview/client/sbin/armdsp -i >>$WORKFILE 2>>$ERRORFILE
  command_debug
  /opt/sanmgr/commandview/client/sbin/armdsp -i | grep Serial | awk '{print $3}' >>${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE
  export ARRAY=1
  echo " " >>$WORKFILE
else
  echo "No HP Disk Arrays to report" >>$WORKFILE
  echo " " >>$WORKFILE
fi
if [ $ARRAY != 0 ] ; then
  for ENC in `cat ${WORKDIR}/arrays.supportinfo.html`
  do
    command_head "ARMDSP Info for Array $ENC"
    ###
    command_subhead "armdsp -a $ENC"
    /opt/sanmgr/commandview/client/sbin/armdsp -a $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "armfeature -r $ENC"
    /opt/sanmgr/commandview/client/sbin/armfeature -r $ENC >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    if [ $VAEX = 1 ] ; then
      command_subhead "armdiag collection"
      export ZIPNAME="armdiag"
      ZF=$ZF+1
      echo " - supportinfo may pause an additional 20 minutes or longer here"
      /opt/sanmgr/commandview/client/sbin/armdiag -I -if $ZIPFILE $ENC >>$WORKFILE 2>>$ERRORFILE
      command_debug   
    fi   
  done
fi
rm ${WORKDIR}/arrays.supportinfo.html 2>>$ERRORFILE

#SAS Disk Arrays
###
command_head "SAS INFO"
if [ -x /opt/sas/bin/sasmgr ] ; then
  for SAS in `ioscan -fnkC escsi_ctlr | grep /dev`
  do
     ###
     command_head "SAS Adapter $SAS"     
      ###
      command_subhead "sasmgr get_info -D $SAS"
      /opt/sas/bin/sasmgr get_info -D $SAS >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q vpd"
      /opt/sas/bin/sasmgr get_info -D $SAS -q vpd >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q pci_id"
      /opt/sas/bin/sasmgr get_info -D $SAS -q pci_id >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q smp_addr"
      /opt/sas/bin/sasmgr get_info -D $SAS -q smp_addr >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q lun=all"
      /opt/sas/bin/sasmgr get_info -D $SAS -q lun=all >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q raid"
      /opt/sas/bin/sasmgr get_info -D $SAS -q raid >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q phy=all"
      /opt/sas/bin/sasmgr get_info -D $SAS -q phy=all >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q phy_in_port=all"
      /opt/sas/bin/sasmgr get_info -D $SAS -q phy_in_port=all >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sasmgr get_info -D $SAS -q target=all"
      /opt/sas/bin/sasmgr get_info -D $SAS -q target=all >>$WORKFILE 2>>$ERRORFILE
      command_debug
      echo " " >>$WORKFILE
      done
  else
      echo "SAS Utility not available" >>$WORKFILE
      echo " " >>$WORKFILE
fi

###
command_head "SmartArray INFO"
if [ -x /usr/sbin/sautil ] ; then
  /usr/sbin/sautil run_startup_script >>$WORKFILE 2>>$ERRORFILE
  command_debug
  for SMA in `ioscan -fnkd ciss | grep /dev`
  do
     echo "***** SmartArray" $SMA >>$WORKFILE
      ###
      command_subhead "sautil $SMA stat"
      /usr/sbin/sautil $SMA stat >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sautil $SMA get_pci_header"
      /usr/sbin/sautil $SMA get_pci_header >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sautil $SMA get_trace_buf"
      /usr/sbin/sautil $SMA get_trace_buf >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sautil $SMA"
      /usr/sbin/sautil $SMA >>$WORKFILE 2>>$ERRORFILE
      command_debug
      ###
      command_subhead "sautil $SMA get_fw_err_log -raw"
      /usr/sbin/sautil $SMA get_fw_err_log -raw >>$WORKFILE 2>>$ERRORFILE
      command_debug
#########
#########
      #command_subhead "sautil $SMA get_disk_err_log <ch:id> -raw"
      #loop per drive needed <ch:id>
      #/usr/sbin/sautil $SMA get_disk_err_log <ch:id> -raw >>$WORKFILE 2>>$ERRORFILE
      #command_debug
#########
#########
     echo " " >>$WORKFILE
  done
  echo " " >>$WORKFILE
else
  echo "SA Utility not available" >>$WORKFILE
  echo " " >>$WORKFILE
fi

#EMC Disk Arrays
###
command_head "EMC CLARIION INFO"
if [ -x /opt/Navisphere/bin/navicli ] ; then
  export IPADDR=""
  touch ${WORKDIR}/EMC.supportinfo.html
  /usr/bin/cat /opt/Navisphere/bin/agent.config|grep system|cut -c 8-22 >> ${WORKDIR}/EMC.supportinfo.html
  export IPADDR=`tail -1 ${WORKDIR}/EMC.supportinfo.html | cut -d @ -f 2`
  ###
  command_subhead "/opt/Navisphere/bin/navicli -h $IPADDR getall"
  /opt/Navisphere/bin/navicli -h $IPADDR getall >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  command_subhead "inq -clariion -nodots"
  inq -clariion -nodots >>$WORKFILE 2>>$ERRORFILE
  command_debug
  echo " " >>$WORKFILE
else
  echo "No EMC Clariion Disk Arrays to report" >>$WORKFILE
  echo " " >>$WORKFILE
fi
test -f ${WORKDIR}/EMC.supportinfo.html
if [ $? = 0 ] ; then
   rm ${WORKDIR}/EMC.supportinfo.html
fi
###########################
file_close array

file_create chassis
###########################
###########################
###########################
###
command_head "ll /var/stm/logs/os/"
ll /var/stm/logs/os/* >>$WORKFILE 2>>$ERRORFILE
command_debug

command_head "Chassis Log Collection"
if [ "$CHASSIS" = "1" ]
then
     ###Keystone Based Systems
     command_subhead "cclogview -k /var/stm/logs/os/ccerrlog"
     if [ -f /var/stm/logs/os/ccerrlog ] ; then
          /usr/sbin/diag/contrib/cclogview -k /var/stm/logs/os/ccerrlog >>$WORKFILE 2>>$ERRORFILE
          command_debug
     else
          echo "No ccerrlog found" >>$WORKFILE 
fi

###Olympia_Rainier Based Systems
#alert level 3 and up
for SL in `ls /var/stm/logs/os/fpl.log.*`
      do
        ###
        command_subhead "$SL"
        /usr/sbin/diag/contrib/slview -d -k -a 3 -f $SL >>$WORKFILE 2>>$ERRORFILE
        command_debug
        echo " " >>$WORKFILE
      done
else
  echo "Chassis log collection turned off" >>$WORKFILE
  echo "Use the -ch or -chassis option to enable" >>$WORKFILE
  echo " " >>$WORKFILE
fi
command_debug

###########################
file_close chassis

file_create dtc
###########################
###########################
###########################
###
command_head "DTC 16RX Manager"
test -d /opt/rdtcmgr
if [ $? = 0 ] ; then
    ###
    command_subhead "rdtcver"
    /opt/rdtcmgr/sbin/rdtcver >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "rdtclist -d"
    /opt/rdtcmgr/sbin/rdtclist -d >>$WORKFILE 2>>$ERRORFILE
    command_debug
    ###
    command_subhead "/opt/rdtcmgr/sbin/rdtcstat"
    for DTC in `/opt/rdtcmgr/sbin/rdtclist -d | awk '{print $1}'`
      do
        ###
        command_subhead "$DTC"
        /opt/rdtcmgr/sbin/rdtcstat $DTC >>$WORKFILE 2>>$ERRORFILE
        command_debug
        echo " " >>$WORKFILE
      done
else
  echo "DTC 16RX Manager Not Installed" >>$WORKFILE
  echo " " >>$WORKFILE
fi
###
command_subhead "cat /etc/ddfa/dp"
if [ -f /etc/ddfa/dp ] ; then
     /usr/bin/cat /etc/ddfa/dp >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No /etc/ddfa/dp" >>$WORKFILE 
fi
###
command_subhead "cat /etc/ddfa/pcf"
if [ -f /etc/ddfa/pcf ] ; then
     /usr/bin/cat /etc/ddfa/pcf >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No /etc/ddfa/pcf" >>$WORKFILE 
fi
###
command_subhead "cat /etc/ddfa/predictpcf"
if [ -f /etc/ddfa/predictpcf ] ; then
     /usr/bin/cat /etc/ddfa/predictpcf >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No /etc/ddfa/predictpcf" >>$WORKFILE 
fi
###
command_subhead "ll /dev/telnet"
ll /dev/telnet >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close dtc

file_create devices
###########################
###########################
###########################
###
command_head "Devices"
command_head "ll /dev/*"
ll /dev/* >>$WORKFILE 2>>$ERRORFILE
command_debug
###########################
file_close devices

file_create enviroment
###########################
###########################
###########################
###
command_head "Enviroment"
command_subhead "tty"
/usr/bin/tty >>$WORKFILE 2>>$ERRORFILE
command_debug
command_subhead "env"
/usr/bin/env >>$WORKFILE 2>>$ERRORFILE
command_debug
###########################
file_close enviroment

file_create eventlog
###########################
###########################
###########################
command_head "System Eventlog"
command_subhead "uptime"
uptime >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/stm/logs/tool_stat.html"
/usr/bin/cat /var/stm/logs/tool_stat.html >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "grep -e 'Event data from monitor' -e 'Event Time.' -e 'Severity.' -e 'Monitor.............: ' -e 'Event #.' /var/opt/resmon/log/event.log | dos2ux | grep -v Version"
grep -e 'Event data from monitor' -e 'Event Time.' -e 'Severity.' -e 'Monitor.............: ' -e 'Event #.' /var/opt/resmon/log/event.log | dos2ux | grep -v Version >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/opt/resmon/log/event.log"
/usr/bin/cat /var/opt/resmon/log/event.log >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "/etc/opt/resmon/lbin/moncheck"
if [ `uname -a | awk '{print $3}' | cut -c 3-4` != "11" ] ; then
   echo "Monitor Check not available on this version of O/S" >>$WORKFILE
else
   /etc/opt/resmon/lbin/moncheck >>$WORKFILE 2>>$ERRORFILE
   command_debug
fi
echo " " >>$WORKFILE
###########################
file_close eventlog

file_create fcmsutil
###########################
###########################
###########################
###
command_head "fcmsutil"
if [ -x /opt/fcms/bin/fcmsutil ] ; then
  for FC in `ioscan -fnkC fc | grep /dev`
  do
     ###
     command_subhead "fcmsutil $FC"
     /opt/fcms/bin/fcmsutil $FC >>$WORKFILE 2>>$ERRORFILE
     command_debug
     ###
     command_subhead "fcmsutil $FC devstat all"
     /opt/fcms/bin/fcmsutil $FC devstat all >>$WORKFILE 2>>$ERRORFILE
     command_debug
     for LID in `/opt/fcms/bin/fcmsutil $FC devstat all | grep Loop | awk '{print $6}'| sed s/.$//`
     do
        /opt/fcms/bin/fcmsutil $FC devstat all | grep $LID >>$WORKFILE 2>>$ERRORFILE
        command_debug
        /opt/fcms/bin/fcmsutil $FC test -l $LID >>$WORKFILE 2>>$ERRORFILE
        command_debug
        echo " " >>$WORKFILE             
     done
     /opt/fcms/bin/fcmsutil $FC get remote all >>$WORKFILE 2>>$ERRORFILE
     command_debug     
     echo " " >>$WORKFILE
  done
  ###
  command_subhead "fcdlist"
  /opt/fcms/bin/fcdlist >>$WORKFILE 2>>$ERRORFILE
  command_debug
  echo " " >>$WORKFILE
else
  echo "Fiber Channel Utility not available" >>$WORKFILE
  echo " " >>$WORKFILE
fi
echo " " >>$WORKFILE
###########################
file_close fcmsutil

file_create ignite
###########################
###########################
###########################
command_head "cat /var/opt/ignite/recovery/latest/recovery.log"
if [ -f /var/opt/ignite/recovery/latest/recovery.log ] ; then
   /usr/bin/cat /var/opt/ignite/recovery/latest/recovery.log >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No Ignite logs found" >>$WORKFILE
fi
###########################
file_close ignite

file_create kernel
###########################
###########################
###########################
command_head "Kernel"
command_subhead "lsdev"
/usr/sbin/lsdev >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "kmtune"
if [ -x /usr/sbin/kmtune ] ; then
   /usr/sbin/kmtune >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No kmtune" >>$WORKFILE
fi
###
command_subhead "kctune"
echo " " >>$WORKFILE
if [ -x /usr/sbin/kctune ] ; then
   /usr/sbin/kctune >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No kctune" >>$WORKFILE
fi
###
command_subhead "kmsystem"
if [ -x /usr/sbin/kmsystem ] ; then
   /usr/sbin/kmsystem >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No kmsystem" >>$WORKFILE
fi
###
command_subhead "sysdef"
/usr/sbin/sysdef >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /stand/system"
if [ -f /stand/system ] ; then
   /usr/bin/cat /stand/system >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No kernel" >>$WORKFILE
fi
###
command_subhead "cat /stand/system.prev"
if [ -f /stand/system.prev ] ; then
   /usr/bin/cat /stand/system.prev >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No system.prev" >>$WORKFILE
fi
###
command_subhead "ll /stand/*"
ll /stand/* >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close kernel

file_create lvm
###########################
###########################
###########################
command_head "LVM INFORMATION FOR $SYS2"
###
command_subhead "bdf -i"
/usr/bin/bdf -i >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "df -g"
/usr/bin/df -g >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/fstab"
/usr/bin/cat /etc/fstab >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "strings /etc/lvmtab"
strings /etc/lvmtab >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "lvlnboot -v"
/usr/sbin/lvlnboot -v >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "lifls -l"
for BOOT in `lvlnboot -v | grep "Boot:" | awk '{print $4}'`
  do
    lifcp "$BOOT":AUTO - >>$WORKFILE 2>>$ERRORFILE
    command_debug
    echo " " >>$WORKFILE
    /usr/bin/lifls -l $BOOT >>$WORKFILE 2>>$ERRORFILE
    command_debug
done
###
command_subhead "setboot -v"
/usr/sbin/setboot -v >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "swapinfo -t"
/usr/sbin/swapinfo -t >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/lvmpvg"
if [ -f /etc/lvmpvg ] ; then
   /usr/bin/cat /etc/lvmpvg >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No LVMPVG file" >>$WORKFILE
fi
###
command_subhead "cat /etc/lvmrc"
if [ -f /etc/lvmrc ] ; then
   /usr/bin/cat /etc/lvmrc >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No LVMRC file" >>$WORKFILE
fi
###
command_subhead "vgdisplay -v"
/usr/sbin/vgdisplay -v >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_head "lvdisplay -v"
for LV in `vgdisplay -v | grep 'LV Name' | awk '{print $3}'`
  do
    ###
    command_subhead "lvdisplay -v $LV" 
    /usr/sbin/lvdisplay -v $LV >>$WORKFILE 2>>$ERRORFILE
    command_debug
done
###########################
file_close lvm

file_create manifest
###########################
###########################
###########################
###
command_head "print_manifest -o"
if [ -x /opt/ignite/bin/print_manifest ] ; then
  /opt/ignite/bin/print_manifest -o >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "No Manifest Installed" >>$WORKFILE
fi
###########################
file_close manifest

file_create networking
###########################
###########################
###########################
command_head "NETWORKING INFO FOR $SYS2"
###
command_subhead "cat /etc/hosts"
/usr/bin/cat /etc/hosts >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/rc.config.d/netconf"
/usr/bin/cat /etc/rc.config.d/netconf >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "lanscan"
/usr/sbin/lanscan >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/nsswitch.conf"
if [ -f /etc/nsswitch.conf ] ; then
command_debug
     /usr/bin/cat /etc/nsswitch.conf >>$WORKFILE 2>>$ERRORFILE
else
     echo "No nsswitch.conf" >>$WORKFILE 
fi
###
command_subhead "cat /etc/resolv.conf"
if [ -f /etc/resolv.conf ] ; then
     /usr/bin/cat /etc/resolv.conf >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No resolv.conf" >>$WORKFILE 
fi
###
command_head "NETSTAT"
###
command_subhead "netstat -in"
/usr/bin/netstat -in >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat -rn"
/usr/bin/netstat -rn >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat -s"
/usr/bin/netstat -s >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat -M"
/usr/bin/netstat -M >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat -Ms"
/usr/bin/netstat -Ms >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat -Gn"
/usr/bin/netstat -Gn >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "netstat"
/usr/bin/netstat >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close networking

file_create partition
###########################
###########################
###########################
###
command_head "parstatus"
if [ -x /usr/sbin/parstatus ] ; then
  /usr/sbin/parstatus >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "No Partition Manager" >>$WORKFILE
fi
###
command_head "frupower"
if [ -x /usr/sbin/frupower ] ; then
  ###
  command_subhead "frupower -d -I"
  /usr/sbin/frupower -d -I >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  command_subhead "frupower -d -C"
  /usr/sbin/frupower -d -C >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "No Partition Manager" >>$WORKFILE
fi
###
command_head "iCap"
if [ -x /usr/sbin/icapstatus ] ; then
  ###
  command_subhead "icapstatus"
  /usr/sbin/icapstatus >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "No iCap Installed" >>$WORKFILE
fi
###########################
file_close partition

file_create pci
###########################
###########################
###########################
###
command_head "PCI"
command_subhead "rad -q"
/usr/bin/rad -q >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "olrad -q"
/usr/bin/olrad -q >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/adm/hotplugd.log"
if [ -f /var/adm/hotplugd.log ] ; then
  /usr/bin/cat /var/adm/hotplugd.log >>$WORKFILE 2>>$ERRORFILE
  command_debug
else
  echo "No hotplugd.log available" >>$WORKFILE
fi
###########################
file_close pci

file_create profile
###########################
###########################
###########################
###
command_head "Profile"
command_subhead "cat /.profile"
if [ -f /.profile ] ; then
     /usr/bin/cat /.profile >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No /.profile" >>$WORKFILE 
fi
echo " " >>$WORKFILE
###########################
file_close profile

file_create process
###########################
###########################
###########################
###
command_head "Process"
command_subhead "top -f"
/usr/bin/top -f $WORKFILE -n1000 2>>$ERRORFILE
command_debug
###
command_subhead "ps -ef"
ps -ef >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "UNIX95= ps -e -o ruser,vsz,pcpu,pid,ppid,args|sort -rnk2"
UNIX95= ps -e -o ruser,vsz,pcpu,pid,ppid,args|sort -rnk2 >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "UNIX95=1 ps -Hfe"
UNIX95=1 ps -Hfe >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "sar 1 9"
sar 1 9 >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close process

file_create rootmail
###########################
###########################
###########################
###
command_head "root Mail"
command_subhead "cat /var/mail/root"
if [ "$NOROOT" = 1 ] ; then
   echo "Mail Collection Off" >>$WORKFILE
else
   if [ -f /var/mail/root ] ; then
     /usr/bin/cat /var/mail/root >>$WORKFILE 2>>$ERRORFILE
     command_debug
   else
     echo "No mail." >>$WORKFILE
   fi
fi
###########################
file_close rootmail

file_create sam
###########################
###########################
###########################
###
command_head "SAM Logs"
command_subhead "cat /var/sam/log/samlog"
/usr/bin/cat /var/sam/log/samlog >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/sam/log/samlog.old"
/usr/bin/cat /var/sam/log/samlog.old >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/sam/log/samagent.log"
/usr/bin/cat /var/sam/log/samagent.log >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close sam

file_create sendmail
###########################
###########################
###########################
command_head "sendmail Config"
if [ "$MAIL" = 1 ] ; then
   ###
   command_subhead "cat /etc/mail/sendmail.cf"
   if [ -f /etc/mail/sendmail.cf ] ; then
      /usr/bin/cat /etc/mail/sendmail.cf >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No Sendmail.cf file" >>$WORKFILE
   fi
   ###
   command_subhead "cat /etc/mail/sendmail.cw"
   if [ -f /etc/mail/sendmail.cw ] ; then
      /usr/bin/cat /etc/mail/sendmail.cw >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No sendmail.cw file" >>$WORKFILE
   fi
   ###
   command_subhead "cat /etc/mail/service.switch"
   if [ -f /etc/mail/service.switch ] ; then
      /usr/bin/cat /etc/mail/service.switch >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No service.switch" >>$WORKFILE
   fi
   ###
   command_subhead "cat /etc/rc.config.d/mailservs"
   if [ -f /etc/rc.config.d/mailservs ] ; then
      /usr/bin/cat /etc/rc.config.d/mailservs >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No /etc/rc.config.d/mailservs file" >>$WORKFILE
   fi
   ###
   command_subhead "cat /etc/mail/sendmail.pid"
   if [ -f /etc/mail/sendmail.pid ] ; then
      /usr/bin/cat /etc/mail/sendmail.pid >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No sendmail.pid file" >>$WORKFILE
   fi
   ###
   command_subhead "ll /etc/mail/*"
   ll /etc/mail/* >>$WORKFILE 2>>$ERRORFILE
   command_debug
   ###
   command_subhead "cat /etc/resolve.conf"
   if [ -f /etc/resolve.conf ] ; then
      /usr/bin/cat /etc/resolve.conf >>$WORKFILE 2>>$ERRORFILE
      command_debug
   else
      echo "No resolve.conf file" >>$WORKFILE
   fi
   echo " " >>$WORKFILE
else
   echo "No mail option specified." >>$WORKFILE
fi
###########################
file_close sendmail

file_create serviceguard
###########################
###########################
###########################
###
command_head "MC/ServiceGuard"
command_subhead "cmviewcl -v"
if [ -x /usr/sbin/cmviewconf ] ; then
  /usr/sbin/cmviewcl -v >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  command_subhead "cmviewconf"
  /usr/sbin/cmviewconf >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  command_subhead "cmgetconf -c"
  /usr/sbin/cmgetconf -c >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  echo " " >>$WORKFILE
  command_subhead "ll /etc/cmcluster/*"
  ll /etc/cmcluster/* >>$WORKFILE 2>>$ERRORFILE
  command_debug
  ###
  command_subhead "tar /etc/cmcluster"
  cd /etc/cmcluster
  tar -cvf ${WORKDIR}/$SYS.SG_etc_cmcluster.tar . >>$WORKFILE 2>>$ERRORFILE
  #/usr/contrib/bin/gzip ${WORKDIR}/$SYS.SG_etc_cmcluster.tar
  cd ${WORKDIR}
  command_debug
  TF=$TF+1
  command_debug 
else
  echo "ServiceGuard not available" >>$WORKFILE
  echo " " >>$WORKFILE
fi
###########################
file_close serviceguard

file_create startup
###########################
###########################
###########################
###
command_head "System Startup"
command_subhead "cat /etc/inittab"
/usr/bin/cat /etc/inittab >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "ll /sbin/rc*"
ll /sbin/rc* >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close startup

file_create sw
###########################
###########################
###########################
###
command_head "Software and Patch Information"
command_subhead "cat /var/adm/sw/.codewords"
if [ -f /var/adm/sw/.codewords ] ;then
   /usr/bin/cat /var/adm/sw/.codewords >>$WORKFILE 2>>$ERRORFILE
   command_debug
else
   echo "No CodeWords Installed" >>$WORKFILE
fi
###
command_subhead "swlist"
/usr/sbin/swlist >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "swlist -l product"
/usr/sbin/swlist -l product >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "swlist -l fileset -a state | grep -e transient -e corrupt -e available -e installed"
/usr/sbin/swlist -l fileset -a state | grep -e transient -e corrupt -e available -e installed >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/adm/sw/swagent.log"
if [ -f /var/adm/sw/swagent.log ] ; then
     /usr/bin/cat /var/adm/sw/swagent.log >>$WORKFILE 2>>$ERRORFILE
     command_debug
else
     echo "No swagent.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swagentd.log"
if [ -f /var/adm/sw/swagentd.log ] ; then
/usr/bin/cat /var/adm/sw/swagentd.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swagentd.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swconfig.log"
if [ -f /var/adm/sw/swconfig.log ] ; then
/usr/bin/cat /var/adm/sw/swconfig.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swconfig.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swinstall.log"
if [ -f /var/adm/sw/swinstall.log ] ; then
/usr/bin/cat /var/adm/sw/swinstall.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swinstall.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swmodify.log"
if [ -f /var/adm/sw/swmodify.log ] ; then
/usr/bin/cat /var/adm/sw/swmodify.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swmodify.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swreg.log"
if [ -f /var/adm/sw/swreg.log ] ; then
/usr/bin/cat /var/adm/sw/swreg.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swreg.log" >>$WORKFILE
fi
###
command_subhead "cat /var/adm/sw/swremove.log"
if [ -f /var/adm/sw/swremove.log ] ; then
/usr/bin/cat /var/adm/sw/swremove.log >>$WORKFILE 2>>$ERRORFILE
command_debug
else
     echo "No swremove.log" >>$WORKFILE
fi
###########################
file_close sw

file_create syslog
###########################
###########################
###########################
###
command_head "LOGS"
command_subhead "cat /var/adm/syslog/syslog.log"
/usr/bin/cat /var/adm/syslog/syslog.log >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /var/adm/syslog/OLDsyslog.log"
/usr/bin/cat /var/adm/syslog/OLDsyslog.log >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "dmesg"
/usr/sbin/dmesg >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/rc.log"
/usr/bin/cat /etc/rc.log >>$WORKFILE 2>>$ERRORFILE
command_debug
###
command_subhead "cat /etc/rc.log.old"
/usr/bin/cat /etc/rc.log.old >>$WORKFILE 2>>$ERRORFILE
command_debug
echo " " >>$WORKFILE
###########################
file_close syslog

file_create tombstones
###########################
###########################
###########################
###
command_head "Tombstone Information"
command_subhead "crashconf -v"
if [ -x /sbin/crashconf ] ; then
/sbin/crashconf -v >>$WORKFILE 2>>$ERRORFILE
command_debug
else
  echo "crashconf not available" >>$WORKFILE
  echo " " >>$WORKFILE
fi
###
command_subhead "cat /var/tombstones/ts99"
if [ -f /var/tombstones/ts99 ] ; then
  /usr/bin/cat /var/tombstones/ts99 >>$WORKFILE 2>>$ERRORFILE
  command_debug
fi
###
command_subhead "cat /var/tombstones/ts98"
if [ -f /var/tombstones/ts98 ] ; then
  /usr/bin/cat /var/tombstones/ts98 >>$WORKFILE 2>>$ERRORFILE
  command_debug
fi
###########################
file_close tombstones

################################################################
#Add final error count to errorfile
echo " " >>$ERRORFILE
echo "       ____________________________________" >>$ERRORFILE
echo "Final Error Count:" $ERRC >>$ERRORFILE
echo "       ____________________________________" >>$ERRORFILE
file_close error
################################################################
#Add final timestamp to debugfile
echo " " >>$DEBUGFILE
echo "       ____________________________________" >>$DEBUGFILE
echo "Final Timestamp: `date`" >>$DEBUGFILE
echo "       ____________________________________" >>$DEBUGFILE
file_close debug
################################################################
#Create directory and tar and gzip
test -d ${WORKDIR}/support
if [ $? != 0 ] ; then
  mkdir ${WORKDIR}/support
fi
mv ${WORKDIR}/$SYS.*.html ${WORKDIR}/support
#include zip files
if [ $ZF -ne 0 ] ; then
mv ${WORKDIR}/$SYS.*.html.zip ${WORKDIR}/support
fi
#include tar files
if [ $TF -ne 0 ] ; then
mv ${WORKDIR}/$SYS.*.tar ${WORKDIR}/support
fi
cd ${WORKDIR}/support
echo "Tar the output files..."
tar -cf $SYS.tar *
echo "Gzip the tar output file..."
/usr/contrib/bin/gzip ${WORKDIR}/support/$SYS.tar
mv ${WORKDIR}/support/$SYS.tar.gz $OUTDIR
cd /
echo "Cleanup Work Directory"
cleanup_workdir
echo " "
echo "Script collection is complete"
#RCP file transfer
if [ "$RCPO" = "1" ] ; then
     echo "Moving output file to $RHOST : $RPATH/$SYS.tar.gz"
     rcp $OUTDIR/$SYS.tar.gz $RHOST:$RPATH
     remsh $RHOST ll $RPATH/$SYS.tar.gz
fi
#end supportinfo
echo " "
echo "Your local file is named ${OUTDIR}/${SYS}.tar.gz"
echo "Please forward this file to support@sherlockservices.com"
echo " "
echo "Thank You"
echo " "

