cd `dirname $0`
export JAVA_HOME=/home/yubuntu/program/jdk1.7.0_79/
echo stoping tomcat..
trytimes=0
while :
do
`pwd`/bin/shutdown.sh > /dev/null 2>&1
let trytimes+=1
pid=$(ps -ef | grep java | grep `pwd`| awk '{print $2}')
if [ $pid ]; then
if [ $trytimes -ge 3 ]; then
echo -n "已经尝试了$trytimes次了,是否强制杀死tomcat进程($pid)? (yes/no):"
while :
do
read confirm
declare -l confirm=$confirm
if [ "$confirm" == "y" ] || [ "$confirm" == "yes" ]; then
echo "正在杀死进程.."
kill $pid
echo "进程已杀死"
break 2;
elif [ "$confirm" == "n" ] || [ "$confirm" == "no" ]; then
echo '您选择了否'
break 2;
else
echo -n "请输入yes/y/n/no(不区分大小写):"
fi
done
fi
else
echo "stoped!"
break
fi
done
`pwd`/bin/startup.sh > /dev/null &
tail -fn0 `pwd`/logs/catalina.out
export JAVA_HOME=/home/yubuntu/program/jdk1.7.0_79/
echo stoping tomcat..
trytimes=0
while :
do
`pwd`/bin/shutdown.sh > /dev/null 2>&1
let trytimes+=1
pid=$(ps -ef | grep java | grep `pwd`| awk '{print $2}')
if [ $pid ]; then
if [ $trytimes -ge 3 ]; then
echo -n "已经尝试了$trytimes次了,是否强制杀死tomcat进程($pid)? (yes/no):"
while :
do
read confirm
declare -l confirm=$confirm
if [ "$confirm" == "y" ] || [ "$confirm" == "yes" ]; then
echo "正在杀死进程.."
kill $pid
echo "进程已杀死"
break 2;
elif [ "$confirm" == "n" ] || [ "$confirm" == "no" ]; then
echo '您选择了否'
break 2;
else
echo -n "请输入yes/y/n/no(不区分大小写):"
fi
done
fi
else
echo "stoped!"
break
fi
done
`pwd`/bin/startup.sh > /dev/null &
tail -fn0 `pwd`/logs/catalina.out