tomcat多实例启动和关闭脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat多实例启动和关闭脚本相关的知识,希望对你有一定的参考价值。
1、tomcat启动脚本
#!/bin/sh
# description: 启动tomcat多实例.
. /etc/init.d/functions
RETVAL=$?
# tomcat实例目录
export CATALINA_BASE="$PWD"
# tomcat安装目录
export CATALINA_HOME="/var/opt/tomcat"
# 可选
export JVM_OPTIONS="-Xms128m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];then
echo "Start Tomcat"
$CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];then
echo "Stop Tomcat"
$CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL
2、tomcat 关闭服务脚本
#!bin/bash
#杀掉tomcat进程
package=${*}
dir=‘/var/opt/tomcat‘
pid=ps -ef | grep "${dir}/${package}"|grep -v ‘grep‘ | awk ‘{print $2}‘
if [ ! -n "$pid" ];then
echo -e "