批量启动
#!/bin/sh
BASE_PATH="/usr/local/tomcat8/tomcat-ins/"
bash $BASE_PATH/web1/tomcat.sh start&&
bash $BASE_PATH/web2/tomcat.sh start&&
bash $BASE_PATH/web3/tomcat.sh start
批量停止
#!/bin/bash
BASE_PATH="/usr/local/tomcat8/tomcat-ins"
bash $BASE_PATH/web1/tomcat.sh stop&&
bash $BASE_PATH/web2/tomcat.sh stop&&
bash $BASE_PATH/web3/tomcat.sh stop
批量重启
#!/bin/sh
BASE_PATH="/usr/local/tomcat8/tomcat-ins/"
bash $BASE_PATH/web1/tomcat.sh restart&&
bash $BASE_PATH/web2/tomcat.sh restart&&
bash $BASE_PATH/web3/tomcat.sh restart
单个实例脚本
#!/bin/sh
CUR_PATH=`dirname $0`
export JAVA_HOME="/usr/java/jdk1.8.0_131/"
export CATALINA_BASE="$CUR_PATH"
export CATALINA_HOME="/usr/local/tomcat8"
case $1 in
start)
bash $CATALINA_HOME/bin/startup.sh
;;
stop)
bash $CATALINA_HOME/bin/shutdown.sh
;;
restart)
bash $CATALINA_HOME/bin/shutdown.sh&&
bash $CATALINA_HOME/bin/startup.sh
;;
*)
echo"usage : $0 { start | stop | restart }"
;;
esac
服务脚本
#!/bin/bash
#
# kenny [email protected]
# /etc/rc.d/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# description: tomcat is a j2se server
# chkconfig: 2345 86 16
# description: Start up the Tomcat servlet engine.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo -e "/atomcat: unable to locate functions lib. Cannot continue."
exit -1
fi
RETVAL=$?
CATALINA_HOME="/usr/local/tomcat8"
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/start.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/start.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/stop.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/stop.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
单个实例server.xml配置