Am attempting to write a script that will monitor some oracle processes. I have a file that it read from that only contains the following two lines
The filename is oradbproc2.lis). I am running the script from the SP control workstation using the dsh command. Can someone please help me troubleshoot why it is not working. Probably syntax but don't know. Thanks
sp18cw:tnslsnr TRN::The TRN DB Listener process on SP18 is down:
sp18cw:FNDLIBR:appltrn:The TRN Concurrent Manager process on SP18 is down:
My script looks like this:
#!/bin/ksh
##
for line in `cat /bin/danka/oradbproc2.lis`
do
SERVER=`echo "$line"|cut -f 1 -d :`
PROC=`echo "$line"|cut -f 2 -d :`
USER=`echo "$line"|cut -f 3 -d :`
MAILMSG=`echo "$line"|cut -f 4 -d :`
RC=1
ping -c 5 ${SERVER} 1>/dev/null 2>/dev/null
if [ $? = 1 ]
then
clear
echo "\n\n\n"
echo "Server: ${SERVER} is not available......\n"
echo "Contact UNIX Support.....\n\n\n"
set $RC=0
else
dsh -w ${SERVER} ps -ef |grep -i "${PROC}" |grep ${USER} |grep -v grep
if [ $? = 1 ]
then
$MAILMSG|mail -s ORACLE ALERT 4556720@archwireless.net
set $RC=0
fi
fi
done
sp18cw:tnslsnr TRN::The TRN DB Listener process on SP18 is down:
sp18cw:FNDLIBR:appltrn:The TRN Concurrent Manager process on SP18 is down:
My script looks like this:
#!/bin/ksh
##
for line in `cat /bin/danka/oradbproc2.lis`
do
SERVER=`echo "$line"|cut -f 1 -d :`
PROC=`echo "$line"|cut -f 2 -d :`
USER=`echo "$line"|cut -f 3 -d :`
MAILMSG=`echo "$line"|cut -f 4 -d :`
RC=1
ping -c 5 ${SERVER} 1>/dev/null 2>/dev/null
if [ $? = 1 ]
then
clear
echo "\n\n\n"
echo "Server: ${SERVER} is not available......\n"
echo "Contact UNIX Support.....\n\n\n"
set $RC=0
else
dsh -w ${SERVER} ps -ef |grep -i "${PROC}" |grep ${USER} |grep -v grep
if [ $? = 1 ]
then
$MAILMSG|mail -s ORACLE ALERT 4556720@archwireless.net
set $RC=0
fi
fi
done