为啥要top,ps不行么

while [ 1 ]
do
sleep 1
if [[ ps -ef | grep 进程名 == "" ]]
then
service XXX restart
fi
done

不知道有没有错