Operating System - Linux
1751735 Members
5669 Online
108781 Solutions
New Discussion

Re: Need to monitor the existance of a process

 
SOLVED
Go to solution
Klaas D. Eenkhoorn
Regular Advisor

Re: Need to monitor the existance of a process

It worked, the process is correctly monitored and the script continues after wards.

Thanks for the help !

Kl@@s
Klaas D. Eenkhoorn
Regular Advisor

Re: Need to monitor the existance of a process

This works:

print_msg "Stopping Production"
su - user -c '${TSAPPLROOT}/bin/startcronjob ${TSAPPLROOT} SERVICE'
if [ $? -eq 0 ]
then
print_msg "Stop Production scheduled succesfully"
else
print_msg "Stop Production scheduling failed"
fi

print_msg "Waiting for Production to finish ..."

TIMEOUT=180 # 3 Minutes time-out
FOUND=1
while [ $FOUND -ne 0 ]
do
FOUND=`/usr/bin/su - user -c showcom | /usr/bin/grep SERVICE | /usr/bin/wc -l`
sleep 2
echo $FOUND
if [ ${TIMEOUT} -le "0" ]
then
echo "Timed-out"
FOUND=0
else
TIMEOUT=`expr ${TIMEOUT} - 1`
fi
done

Thanks.