监控程序是否在执行

#!/bin/bash
source H O M E / . b a s h p r o f i l e i n t = 1 w h i l e [ t r u e ] ; d o p r o = HOME/.bash_profile int=1 while [ true ]; do pro= HOME/.bashprofileint=1while[true];dopro=(ps -ef | grep java-1.0-SNAPSHOT.jar | grep -v grep)
if [ -z “$pro” ]
then echo “wancheng”
echo “wancheng ok” | mail -s “wancheng ok” 邮箱;
else
echo “程序正在运行…”
fi
sleep 300

done

你可能感兴趣的:(linux)