===========================================================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