1753842 Members
8263 Online
108806 Solutions
New Discussion юеВ

problem_in script

 
SOLVED
Go to solution
Soul_1
Respected Contributor

problem_in script

Hi all,

i tried one script for monitoring service and to start the service if its not running (even i am not good at scripting).But this one is not giving the desired o/p. Please check this.


########################################
#this is a sample script for starting the services
while
read service
do
/opt/OV/bin/ovstatus -v $service >>./status.log
if
[ "{/opt/OV/bin/ovstatus -c $service |awk '{print $3}'|grep -v State}" = "NOT_RUNNING" ]
then
/opt/OV/bin/ovstart -v $service >>./started.log
fi
done < ./servicelist
#########################################

Thanks & Regards
4 REPLIES 4
rariasn
Honored Contributor

Re: problem_in script

Hi Soul,

# cat servicelist

rgs,
Soul_1
Respected Contributor

Re: problem_in script

hi,

# cat servicelist
ovet_poll
ovactiond
pmd


Thks
rariasn
Honored Contributor

Re: problem_in script

Hi,

FLOG=./ovstatus.log
date >> $FLOG
ovstatus -v >> $FLOG
echo "------------------------------------------" >> $FLOG
while read service
do
STATUS=$(ovstatus -c ${service}|tail -1|awk '{print $3}')
if [ "$STATUS" != "RUNNING" ]
then
echo "ovstart -v ${service}" >> $FLOG
fi
done < ./servicelist

rgs,
rariasn
Honored Contributor
Solution

Re: problem_in script

Sorry,

...
if [ "$STATUS" != "RUNNING" ]
then
echo "ovstart -v ${service}" >> $FLOG
ovstart -v ${service}
fi
...

rgs,