使用ps做进程查询
#!/bin/sh
while true
do
procnum=`ps -ef|grep "testApp"|grep -v grep|wc -l`
if [ $procnum -eq 0 ]; then
/root/testApp &
fi
sleep 5
done
正文完
#!/bin/sh
while true
do
procnum=`ps -ef|grep "testApp"|grep -v grep|wc -l`
if [ $procnum -eq 0 ]; then
/root/testApp &
fi
sleep 5
done