#! /bin/sh
# $Header: bpps.sh,v 1.14.4.1 2003/11/21 00:12:48 $

#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2003 VERITAS Software Corporation, All Rights Reserved $ *
#***************************************************************************
#
# Script for NetBackup to determine what processes are running.
#
progname='bpps'

# This script will display Media Manager processes if the -a switch
# is specified.  Processes that are not NetBackup related can also
# be added to program lists. 
# The -r option provides a way to list only the Advanced Reporter
# processes. Advanced Reporter processes will be included in requests
# specifying the -a option (if executed on a supported NBAR platform).

Usage="usage: $progname [-a | -r]"
MySQL_bin="/usr/openv/db/bin"

# Note - Do not add any more program/script names to this list,
# since the shell on some unix platforms will not accept a list 
# longer than progs1.  Be sure to adjust the lists for ALPHA
# and in bp.kill_all.

progs1="(bpdm|bptm|bpbrm|bpsched|bpdbm|bpadm|bprd|bpcd|xbp|bp|bparchive|bpbackup|bpbkar|bpimagelist|bplist|bpinst|bprestore|bpbackupdb|bprecover|bpverify|bpduplicate|bpimport|bplabel|bpversion)"

# Note - Do not add any more program/script names to this list,
# since the shell on some unix platforms will not accept a list 
# longer than progs2.  Be sure to adjust the lists for ALPHA
# and in bp.kill_all.

progs2="(backup_notify|restore_notify|session_notify|dbbackup_notify|userreq_notify|bpend_notify|bpstart_notify|bpdbjobs|bpfsmap|tar|bpbkar32|bpjava-msvc|bpjava-usvc|bpjava-susvc|bpjobd)"

# Add new program/script names to this list.
# Be sure to adjust the lists for ALPHA
# and in bp.kill_all.

progs3="(bpchangeprimary|visd|ndmpmoveragent|ndmpsocketmover|mtfrd|bpcoord|bpsynth|bpfis)"

# AdvancedReporter daemons. (Only implemented for Solaris, HP and RS6000).
progs_aro="(ardbmon|arhttpd|armonitor|ardbd|arloader|arpusher)"

# MySQL utilities and daemon
progs_mysql="(start_nbdbd|nbdbsetport|nbdbsetpw|nbdbstop|nbdbupdatedb|nbdbd|nbdbdmon)"

# Vault processes.
progs_vault1="(bpbrmvlt|vltadm|vltcore|vlteject|vltinject|vltoffsitemedia|vltopmenu|vltrun|vltcontainers)"

# Vault scripts.
progs_vault2="(vlt_ejectlist_notify|vlt_end_notify|vlt_starteject_notify|vlt_endeject_notify|vlt_start_notify)"

### ALPHA PLATFORM RELATED *BEGIN*
### 
# The following lists are special for the Alpha platform. If bp is
# included with the other commands, wildcarding will happen causing 
# unwanted commands like bpps to print. So treat bp on its own.

progs1Alpha="(bpdm|bptm|bpbrm|bpsched|bpdbm|bpadm|bprd|bpcd|xbp|bparchive|bpbackup|bpbkar|bpimagelist|bplist|bpinst|bprestore|bpbackupdb|bprecover|bpverify|bpduplicate|bpimport|bplabel|bpversion)"

#  Don't need bpbkar32 on this list since bpbkar gets wildcarded and it gets picked up.
#  If it's on the list, bpbkar32 gets listed twice.

progs2Alpha="(backup_notify|restore_notify|session_notify|dbbackup_notify|userreq_notify|bpend_notify|bpstart_notify|bpdbjobs|bpfsmap|tar|bpjava-msvc|bpjava-usvc|bpjava-susvc|bpjobd)"

progs3Alpha="(bpchangeprimary|visd|ndmpmoveragent|ndmpsocketmover|mtfrd|bpcoord|bpsynth|bpfis)"

progs4Alpha="(bp)"

# bpbrmvlt has been deleted from this list because bpbrm gets wildcarded and it
# gets picked up.  If it's on the list, bpbrmvlt gets listed twice.

progs_vault1_alpha="(vltadm|vltcore|vlteject|vltinject|vltoffsitemedia|vltopmenu|vltrun|vltcontainers)"

# OPTIONAL feature for Alpha platform 
# (generally not required for other platforms)
#  To exclude specified processes from the bpps command:
#  -Create a line of pipe-separated strings that you wish to have
#  bpps bypass and place in /usr/openv/netbackup/.psexcludes. 
#  -An example /usr/openv/netbackup/.psexcludes file: 
#  (xterm|extra)	!Parentheses are required!
#	Processes can be excluded by replacing the word
#	"extra" above with whatever process you want excluded.

if [ -f /usr/openv/netbackup/.psexcludes ] ; then
	ALPHA_EXCLUDES=`cat /usr/openv/netbackup/.psexcludes`
else
	ALPHA_EXCLUDES=""
fi
###
### ALPHA PLATFORM RELATED *END*

if [ -f /usr/openv/netbackup/version ] ; then
	HARDWARE=`head -1 /usr/openv/netbackup/version | cut -f2 -d" "`
else
	echo "/usr/openv/netbackup/version not found"
	exit 1
fi


ECHO="/bin/echo"

#
# process command line arguments
#

opt_all=0
opt_aro=0

#
# Since main's $* gets clobbered when bourne shell functions are called
# with arguments on an HP700 running 9.0x, stuff the argument list into
# a variable and implement shifts using awk.
#

args=$*

while [ -n "$args" ]
do
	option=`$ECHO "$args" | awk '{ print $1 }'`

	if [ "`$ECHO $option | cut -c1`" != "-" ] ; then
		$ECHO "$Usage"
		exit 1
	fi

	case $option in
	-a|-all|-v)	opt_all=1;;
	-r|-ar)		opt_aro=1;;
	*)	$ECHO "$progname: invalid option $option"
		$ECHO "$Usage"
		exit 1;;
	esac

	# simulate a "shift"
	args=`$ECHO "$args" | awk '{ for (i=2; i <= NF; i++) printf "%s ", $i }'`
done

# Advanced Reporter is only implemented on Solaris, HP and RS6000.
if [ $opt_aro -eq 1 ] ; then
	if [ "$HARDWARE" != "SOLARIS" -a "${HARDWARE}" != "HP9000-700" -a \
	     "${HARDWARE}" != "HP9000-800" -a "${HARDWARE}" != "RS6000" ] ; then
		$ECHO "NetBackup Advanced Reporter is not available on this platform."
		exit 0
	fi
fi

if [ $opt_all -eq 1 ] ; then
	$ECHO "NB Processes"
	$ECHO "------------"
fi

# Because of the idiosyncracies of the ps command on different platforms, the
# grepping process to obtain bp processes has some variations.
if [ "$HARDWARE" = "ALPHA" -a -s /usr/openv/netbackup/.psexcludes ] ; then
	# ALPHA's 'ps -ea' returns command with args, so can't put $ in egrep regExpr.
	# Furthermore without $ egrep returns too much, so an 'egrep -v' option is
	# provided to filter out user-supplied processes.
	#
	# There are instances where Tru64 displays the processes in [].
	# Update the egreps to also look for a leading [.

	# Provide list of MySQL processes on ALPHA.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`/bin/ps -ea | egrep '[ /\[]'$progs_mysql | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
		for process in $processes
		do
			/bin/ps wwuax$process | tail +2
		done
	fi

	processes=`/bin/ps -ea | egrep '[ /\[]'$progs1Alpha | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs2Alpha | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs3Alpha | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs4Alpha'$' | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs_vault1_alpha | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs_vault2 | egrep -v $ALPHA_EXCLUDES | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	# find jnbSA/jbpSA/gdmSA processes.
	/bin/ps wwuax | egrep -v $ALPHA_EXCLUDES | grep jre | grep openv | grep NBJAVA
elif [ "$HARDWARE" = "ALPHA" ] ; then
	#
	# There are instances where Tru64 displays the processes in [].
	# Update the egreps to also look for a leading [.

	# Provide list of MySQL processes on ALPHA.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`/bin/ps -ea | egrep '[ /\[]'$progs_mysql | awk '{print $1}'`
		for process in $processes
		do
			/bin/ps wwuax$process | tail +2
		done
	fi

	processes=`/bin/ps -ea | egrep '[ /\[]'$progs1Alpha | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs2Alpha | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs3Alpha | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs4Alpha'$' | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs_vault1_alpha | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	processes=`/bin/ps -ea | egrep '[ /\[]'$progs_vault2 | awk '{print $1}'`
	for process in $processes
	do
		/bin/ps wwuax$process | tail +2
	done
	# find jnbSA/jbpSA/gdmSA processes.
	/bin/ps wwuax | grep jre | grep openv | grep NBJAVA
elif [ "$HARDWARE" = "HP9000-700" -o "$HARDWARE" = "HP9000-800" ] ; then
	#
	# ps on hp only prints 15 characters of the command name.  Commands
	# like dbbackup_notify get missed.  Use the -o option to widen the
	# command name portion of the report (UNIX95 must be set to get
	# this XPG4 behavior).

	# Provide option on HP to list Advanced Reporter daemons only.
	if [ $opt_aro -eq 1 ] ; then
		processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs_aro'$' | awk '{print "-p " $1}'`
		#  Incredibly disgusting hack just for NBAR processes on HP.  Due to the
		#  peculiarities of the OS, ardbmon appears like this
		#  "/bin/sh /usr/openv/nbar/bin/ardbmon" and gets missed.
		#  Do a special check just for it.
		tmp_processes=`env UNIX95=1 /bin/ps -ea -o pid,args | egrep ardbmon'$' | awk '{print "-p " $1}'`
		if test -n "$tmp_processes" ; then
			processes="$processes $tmp_processes"
		fi
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
		# find tomcat processes (eliminate NB and VSM java processes).
		/bin/ps -aef | grep jre | grep openv | grep -v NBJAVA | grep -v vrts.app.ALLOW_APP
		exit 0
	fi

	# Provide list of MySQL processes on HP.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs_mysql'$' | awk '{print "-p " $1}'`
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
	fi

	processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs3'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs_vault1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`env UNIX95=1 /bin/ps -ea -o pid,comm | egrep ' '$progs_vault2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	# find jnbSA/jbpSA/gdmSA processes.
	/bin/ps -aef | grep jre | grep openv | grep NBJAVA

elif [ "$HARDWARE" = "SGI" ] ; then
	# ps(1) on IRIX 6.2 puts a space on the end of "ps -ea"
	# and IRIX 5.2 doesn't, so chop off the space if it's there.
	#
	# ps on sgi only prints 9 characters of the command name.  Commands
	# like bpduplicate get missed.  Use the -o option to widen the command
	# name portion of the report.  The long XXX string is required for this
	# to work...do NOT delete it.

	# Provide list of MySQL processes on SGI.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs_mysql'$' | awk '{print "-p " $1}'`
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
	fi

	processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs3'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs_vault1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	# 16 char limit so redefine progs_vault2 so everything is found.
	progs_vault2="(vlt_ejectlist_no|vlt_end_notify|vlt_endeject_not|vlt_start_notify)"
	processes=`/bin/ps -ea -o pid,comm=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | sed 's/ $//' | egrep ' '$progs_vault2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
elif [ "$HARDWARE" = "SOLARIS" ] ; then
	# ps on solaris only prints 8 characters of the command name. commands
	# like bpduplicate get missed. use solaris -o option to widen the commandName
	# portion of the report.  The long XXX string is required for this to
	# work...do NOT delete it.

	# Provide option on Solaris to list Advanced Reporter daemons only.
	if [ $opt_aro -eq 1 ] ; then
		processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs_aro'$' | awk '{print "-p " $1}'`
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
		# find tomcat processes (eliminate NB and VSM java processes).
		/bin/ps -ef | grep jre | grep openv | grep -v NBJAVA | grep -v vrts.app.ALLOW_APP
		exit 0
	fi

	# Provide list of MySQL processes on Solaris.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs_mysql'$' | awk '{print "-p " $1}'`
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
	fi

	processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs3'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs_vault1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi

	#  Even with -o, the command limit is 15.  Change progs_vault2 list so we find everything.
	progs_vault2="(vlt_ejectlist_n|vlt_end_notify|vlt_endeject_no|vlt_start_notif)"
	processes=`/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | egrep ' '$progs_vault2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps -f $processes | tail +2
	fi
	# find jnbSA/jbpSA/gdmSA processes.
	/bin/ps -ef | grep jre | grep openv | grep NBJAVA
else
	# WARNING:  ps -eaf (which would give us more room for long
	# names) causes the output to contain any arguments.  Since we are
	# grepping for the program/script names specifically at the end,
	# those situations are missed.  Don't use it.

	if [ "$HARDWARE" = "LINUX" ] ; then
		DASH_F=-fww
	else
		DASH_F=-f
	fi

	# Provide option on RS6000 to list Advanced Reporter daemons only.
	if [ $opt_aro -eq 1 ] ; then
		processes=`/bin/ps -ea -o pid,comm | egrep ' '$progs_aro'$' | awk '{print "-p " $1}'`
		#  Incredibly disgusting hack just for NBAR processes on RS6000.  Due to the
		#  peculiarities of the OS, ardbmon appears like this
		#  "/bin/sh /usr/openv/nbar/bin/ardbmon " and gets missed.
		#  Do a special check just for it.
		tmp_processes=`/bin/ps -ea -o pid,args | egrep ardbmon' $' | awk '{print "-p " $1}'`
		if test -n "$tmp_processes" ; then
			processes="$processes $tmp_processes"
		fi
		if test -n "$processes" ; then
			/bin/ps ${DASH_F} $processes | tail +2
		fi
		# find tomcat processes (eliminate NB and VSM java processes).
		/bin/ps -ea $DASH_F | grep jre | grep openv | grep -v NBJAVA | grep -v vrts.app.ALLOW_APP
		exit 0
	fi

	# Provide list of MySQL processes on LINUX and RS6000.
	if [ -f ${MySQL_bin}/nbdbd ] ; then
		processes=`/bin/ps -ea | egrep ' '$progs_mysql'$' | awk '{print "-p " $1}'`
		if test -n "$processes" ; then
			/bin/ps $DASH_F $processes | tail +2
		fi
	fi

	processes=`/bin/ps -ea | egrep ' '$progs1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps $DASH_F $processes | tail +2
	fi
	processes=`/bin/ps -ea | egrep ' '$progs2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps $DASH_F $processes | tail +2
	fi
	processes=`/bin/ps -ea | egrep ' '$progs3'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps $DASH_F $processes | tail +2
	fi
	processes=`/bin/ps -ea | egrep ' '$progs_vault1'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps $DASH_F $processes | tail +2
	fi

	#  The command limit is 15.  Change progs_vault2 list so we find everything.
	if [ "${HARDWARE}" = "LINUX" ] ; then
		progs_vault2="(vlt_ejectlist_n|vlt_end_notify|vlt_endeject_no|vlt_start_notif)"
	fi
	processes=`/bin/ps -ea | egrep ' '$progs_vault2'$' | awk '{print "-p " $1}'`
	if test -n "$processes" ; then
		/bin/ps $DASH_F $processes | tail +2
	fi
	# Can use ps -eaf here because the jnbSA/jbpSA/gdmSA processes are not looked
	# for at the end specifically.  As long as it contains openv and jre,
	# it's considered ours.  Furthermore, it seems I must use eaf in order
	# to see those processes from a window other than the one that originally
	# started them up (Linux and AIX).
	/bin/ps -ea $DASH_F | grep jre | grep openv | grep NBJAVA
fi

if [ $opt_all -eq 1 ] ; then
	$ECHO 
	$ECHO 

	if [ -f /usr/openv/volmgr/bin/vmps ] ; then
		VMPS=/usr/openv/volmgr/bin/vmps
	else
		$ECHO "/usr/openv/volmgr/bin/vmps is not installed"
		$ECHO "$progname: could not display Media Manager processes"
		exit 1
	fi

	$ECHO "MM Processes"
	$ECHO "------------"

	$VMPS
	stat=$?
	if [ $stat -ne 0 ] ; then
		$ECHO "$progname: could not display Media Manager processes"
		exit $stat
	fi

fi

if [ $opt_all -eq 1 ] ; then
	do_it=0
	if [ "${HARDWARE}" = "SOLARIS" ] ; then
		if [ -f /opt/SUNWnbaro/bin/ardbd -o -f /opt/VRTSnbaro/bin/ardbd ] ; then
			do_it=1
			ps_command="/bin/ps -ea -o pid,fname=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
		fi
	elif [ "${HARDWARE}" = "HP9000-700" -o "${HARDWARE}" = "HP9000-800" ] ; then
		if [ -f /usr/openv/nbar/bin/ardbd ] ; then
			do_it=1
			ps_command="env UNIX95=1 /bin/ps -ea -o pid,comm"
		fi
	elif [ "${HARDWARE}" = "RS6000" ] ; then
		if [ -f /usr/openv/nbar/bin/ardbd ] ; then
			do_it=1
			ps_command="/bin/ps -ea -o pid,comm"
		fi
	fi

	if [ ${do_it} -eq 1 ] ; then
		$ECHO
		$ECHO
		$ECHO "ARO Processes"
		$ECHO "-------------"
		processes=`eval ${ps_command} | egrep ' '${progs_aro}'$' | awk '{print "-p " $1}'`
		#  Incredibly disgusting hack just for NBAR processes on HP and RS6000.
		#  Due to the peculiarities of the OS, ardbmon appears like this
		#  "/bin/sh /usr/openv/nbar/bin/ardbmon" and gets missed.
		#  Do a special check just for it.
		if [ "${HARDWARE}" = "HP9000-700" -o "${HARDWARE}" = "HP9000-800" ] ; then
			tmp_processes=`env UNIX95=1 /bin/ps -ea -o pid,args | egrep ardbmon'$' | awk '{print "-p " $1}'`
		elif [ "${HARDWARE}" = "RS6000" ] ; then
			tmp_processes=`/bin/ps -ea -o pid,args | egrep ardbmon' $' | awk '{print "-p " $1}'`
		else
			tmp_processes=""
		fi
		if test -n "$tmp_processes" ; then
			processes="$processes $tmp_processes"
		fi
		if test -n "$processes" ; then
			/bin/ps -f $processes | tail +2
		fi
		# find tomcat processes (eliminate NB and VSM java processes).
		# Make sure to end with exit 0 since if nbar is present but not
		# up the following grep causes bpps to end with a non-zero exit
		# status.  GDM, at a minimum, checks bpps' exit status.
		/bin/ps -eaf | grep jre | grep openv | grep -v NBJAVA | grep -v vrts.app.ALLOW_APP
		exit 0
	fi
fi
