#主要针对开机启动程序
#! /bin/bash
IF_START="/etc/init.d/xxxxxx"
CHECK_1="/xxxxx/xxxx -xxxxxxxx"
check_2()
{
aaa=`ps -ef | grep "XXXX" | grep -v "grep" | awk '{ print $1 }' | sed -n 1p`
bbb=`ps -ef | grep "XXX" | grep -v "grep" | awk '{ print $1 }' | sed -n 1p`
if [ "$aaa" != "root" ]
then
$CHECK_1
if [ "$?" -ne "0" ]
then
if [ "$bbb" != "root" ]
then
$IF_START restart
fi
else
$IF_START restart
fi
fi
}
check_2