Consultor Eletrônico



Kbase P117037: Script to create stack traces on several Unix flavors for the most common Progress executables.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/08/2006
Status: Unverified

GOAL:

Script to create stack traces on several Unix flavors for the most common Progress executables.

GOAL:

Script to create stack traces on several Unix flavors for the most common OpenEdge executables.

FIX:

#!/bin/ksh
me=`who am i|awk '{ print $1 }'`
if [ $me != "root" ]
then
{
echo "You are not logged in as root."
echo "Root permissions are needed to run "
echo "some of the utilities in this script."
exit
}
fi
if [ -z "$DLC" ]
then
{
echo "DLC is not set script can not procede."
exit
}
fi
DATETIME=`date +%m%d%Y-%H%M%S`
sleep 5
`mkdir $DATETIME`
if [ -d "${DATETIME}" ]
then
{
cd "$DATETIME"
}
else
{
echo "Unable to create temporary directory $DATETIME to sto
re files."
}
fi
#If any probuild executables are made then they should also
#be searched for and added to the pslist variable.
PROSRV=${PROSRV-_mprosrv}
PROEXE=${PROEXE-_progres}
PROSHUT=${PROSHUT-_mprshut}
PROAPSV=${PROAPSV-_proapsv}
PROUTIL=${PROUTIL-_proutil}
pslist=`ps -ef|grep -v grep|grep -i $PROEXE|awk '{print $2}'`
pslist="$pslist `ps -ef|grep -v grep|grep -i $PROSRV|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i $PROSHUT|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i $PROUTIL|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i $PROAPSV|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i _rfutil|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i _dbutil|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i _sqlsrv2|awk '{print $2}'`"
pslist="$pslist `ps -ef|grep -v grep|grep -i java|awk '{print $2}'`"
ostype=`uname`
if [ $ostype = "AIX" ]
then
{
i=0
for i in $pslist
do
{
procstack $i>>$i.stack
sleep 2
procstack $i>>$i.stack
}
done
echo "Please locate and move all protrace files created today to the "$DATETIME" directory."
}
fi

if [ $ostype = "SunOS" ]
then
{
me=`/usr/ucb/whoami`
if [ -x `whence pstack` ]
then
{
pstack $pslist>>pstack.out
}
else
{
echo "Couldn't find pstack.">>pstack.out
i=0
for i in $pslist
do
{
kill -16 $i
sleep 2
kill -16 $i
}
done
echo "Please locate and move all protrace files created to day to the "$DATETIME" directory."
}
fi
}
fi
if [ $ostype = "Linux" ]
then
{
i=0
for i in $pslist
do
{
kill -10 $i
sleep 2
kill -10 $i
}
done
echo "Please locate and move all protrace files created today to the "$DATETIME" directory."
}
fi
if [ $ostype = "HP-UX" ]
then
{
i=0
for i in $pslist
do
{
kill -16 $i
sleep 2
kill -16 $i
}
done
echo "Please locate and move all protrace files created to day to the $DATETIME directory."
}
fi
#end of stack generation script