Skip to content

Instantly share code, notes, and snippets.

@yantonov
Created July 7, 2013 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yantonov/5942445 to your computer and use it in GitHub Desktop.
Save yantonov/5942445 to your computer and use it in GitHub Desktop.
tomcat start/stop script
#!/bin/bash
# Tomcat start/stop script
export JAVA_HOME=~/Development/bin/jdk
export CATALINA_HOME=~/Development/bin/tomcat
export JAVA_OPTS="-Dorg.apache.catalina.session.StandardSession.ACTIVITY_CHECK=true -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true"
CONTEXT_CONF_DIR=`dirname $0`/app-context
function out_action() {
echo "--------------------------------"
echo $1
echo "--------------------------------"
}
function out_progress() {
echo "[ $1 ]"
}
function start_tomcat() {
out_action "starting apache tomcat"
bash $CATALINA_HOME/bin/catalina.sh jpda start
out_progress "starting ..."
sleep 3
out_progress "ok"
}
function stop_tomcat() {
out_action "stopping apache tomcat"
bash $CATALINA_HOME/bin/shutdown.sh
out_progress "stoping ..."
sleep 3
out_progress "ok"
}
function copyAllContextInfo() {
out_action "copy all context info"
out_progress "copying ..."
cp -R $CONTEXT_CONF_DIR/* $CATALINA_HOME/conf/Catalina/
out_progress "ok"
}
case $1 in
start)
start_tomcat
;;
stop)
stop_tomcat
;;
restart)
stop_tomcat
start_tomcat
;;
context)
stop_tomcat
copyAllContextInfo
start_tomcat
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment