===========================================================html
===========================================================java
#!/bin/bash while true do procnum=` ps -ef|grep "test"|grep -v grep|wc -l` if [ $procnum -eq 0 ]; then /home/test& fi sleep 30 done 注:-eq意思是等于0,用于判断该test是否还在运行状态。监控/home/test这个程序是否运行。
===========================================================linux