2012年8月6日 星期一
shell script function 範例
Starttomcat(){
/opt/tomcat/bin/start.sh
}
CHECK_START() {
sleep 5
STATUS=`tail -n 10 $INSTENCE_LOG | grep -c "Server startup in"`
if [ "$STATUS" -eq "1" ];then
echo tomcat restart OK
CHECK_IPTABLE
else
Killtomcat
sleep 1
Starttomcat
CHECK_START
fi
}
case $1 in
start)
Starttomcat
CHECK_START
# StartApache
;;
stop)
Killtomcat
;;
restart)
Killtomcat
sleep 1
Starttomcat
CHECK_START
;;
*)
echo $"Usage: {start|stop|restart}"
exit 1
;;
esac
訂閱:
文章 (Atom)