我的tomcat服务器 是放在/opt 文件下面的 ,脚本路径要对应好哦!
#!/bin/bash
#program
#this progarm is restart tomcat srever
#history
#2016/11/30 lilei frist release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATH
read -p "are you sure (y/n) you want to restart the tomcat server:" isornot
if [ "${isornot}"=="y" -o "${isornot}"=="Y" ]; thenif test -d /opt/apache-tomcat-8.5.4 ; then
if test -x /opt/apache-tomcat-8.5.4/bin/shutdown.sh -a /ope/apache-tomcat-8.5.4/bin/startup.sh; then
/opt/apache-tomcat-8.5.4/bin/shutdown.sh
/opt/apache-tomcat-8.5.4/bin/startup.sh
else
echo "you do not have access to this file"
fi
else
echo "this directory does not exist!"
fi
echo "restart success"
exit 0
else
echo " server does not restart!"
exit 0
fi