首页 » 嵌入式笔记 » 正文

shell 实现监控程运行并自动重启

使用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

发表评论