Skip to content

Instantly share code, notes, and snippets.

@goncha
Created November 8, 2012 07:09
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 goncha/4037341 to your computer and use it in GitHub Desktop.
Save goncha/4037341 to your computer and use it in GitHub Desktop.
BASH script to control tomcat instance on customized CATALINA_BASE with CATALINA_PID
#!/bin/sh
usage () {
echo "Usage: $0 <startup|shutdown>"
exit 1
}
if [ $# -lt 1 ]
then
usage
fi
INSTANCE_BASE=$(dirname $0)
INSTANCE_BASE=$(pwd -P $INSTANCE_BASE)
INSTANCE_BASE=${INSTANCE_BASE%%/bin}
export JAVA_HOME=/home/app/opt/jdk
export CATALINA_HOME=/home/app/opt/tomcat
export CATALINA_BASE=$INSTANCE_BASE
export CATALINA_PID=$CATALINA_BASE/logs/catalina.pid
if [ "$1" == "startup" ]
then
$CATALINA_HOME/bin/startup.sh start
elif [ "$1" == "shutdown" ]
then
$CATALINA_HOME/bin/shutdown.sh
else
usage
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment