将脚本置于tomcat/bin目录下restart.sh
chmod +x restart.sh 赋予可执行权限
执行命令:./restart.sh
#!/bin/sh SERVER_PATH=`pwd` SERVER_PID=`ps -ef |grep java| grep -m 1 $SERVER_PATH |awk ‘{print $2}‘` kill -9 $SERVER_PID sleep 1 sh $SERVER_PATH/startup.sh && tailf ../logs/catalina.out