Consultor Eletrônico



Kbase P117065: Script to gather stack data on running Progress processes.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/27/2009
Status: Verified

GOAL:

Script to gather stack data on running Progress processes.

FACT(s) (Environment):

UNIX
Progress 9.x
OpenEdge 10.x
Progress 8.x

FIX:

#!/bin/ksh
me=`whoami`
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
tar --exclude=\*.tar --exclude=\*.gz -cvzf protrace$DATETIME.tar .`find . -name protrace\* -print`
echo "Please send the protrace$DATETIME.tar.gz file to Progress."
}
fi

if [ $ostype = "SunOS" ]
then
{
me=`/usr/ucb/whoami`
if [ -x `whence pstack` ]
then
{
pstack $pslist>>pstack.out
sleep 2
pstack $pslist>>pstack.out
tar --exclude=\*.tar --exclude=\*.gz -cvzf protrace$DATETIME.tar `find . -name protrace\* -print`

}
else
{
echo "Couldn't find pstack.">>pstack.out
i=0
for i in $pslist
do
{
kill -s USR1 $i
sleep 2
kill -s USR1 $i
}
done
tar --exclude=\*.tar --exclude=\*.gz -cvzf protrace$DATETIME.tar `find / -name protrace\* -print`
echo "Please send the protrace$DATETIME.tar.gz file to Progress."
}
fi
}
fi
if [ $ostype = "Linux" ]
then
{
i=0
for i in $pslist
do
{
kill -s USR1 $i
sleep 2
kill -s USR1 $i
}
done
tar --exclude=\*.tar --exclude=\*.gz -cvzf protrace$DATETIME.tar `find / -name protrace\* -print`
echo "Please send the protrace$DATETIME.tar.gz file to Progress."
}
fi
if [ $ostype = "HP-UX" ]
then
{
i=0
for i in $pslist
do
{
kill -s USR1 $i
sleep 2
&nbsp.; kill -s USR1 $i
}
done
tar --exclude=\*.tar --exclude=\*.gz -cvzf protrace$DATETIME.tar `find / -name protrace\* -print`
echo "Please send the protrace$DATETIME.tar.gz file to Progress."
}
fi
.