Skip to content

Instantly share code, notes, and snippets.

@mtheoryx
Created July 12, 2012 18:22
Show Gist options
  • Select an option

  • Save mtheoryx/3099906 to your computer and use it in GitHub Desktop.

Select an option

Save mtheoryx/3099906 to your computer and use it in GitHub Desktop.
# Tomcat
function tomcat () {
# starting or stopping?
case "$1" in
"start")
#what sakai.properties file for chosen db?
case "$2" in
"local")
cd /opt/props && git checkout 'local'
echo "using MySQL-configured branch"
;;
"dev")
cd /opt/props && git checkout 'dev'
echo "using ONC1DEV-configured branch"
;;
"reg")
cd /opt/props && git checkout 'reg'
echo "using ONC1REG-configured branch"
;;
"sbx")
cd /opt/props && git checkout 'sbx'
echo "using ONC1SBX-configured branch"
;;
"stg")
cd /opt/props && git checkout 'stg'
echo "using ONC1STG-configured branch"
;;
"tst")
cd /opt/props && git checkout 'tst'
echo "using ONC1TST-configured branch"
;;
esac
case "$3" in
"debug" ) /opt/tomcat/bin/startup.sh
;;
esac
/opt/tomcat/bin/startup.sh
;;
"stop") /opt/tomcat/bin/shutdown.sh
echo "Attempting to shut down tomcat..."
sleep 10
#make sure it actually stops!!
while [ `ps aux | grep '[L]ibrary/Java/Home/bin/java' | awk '{print $11}' | wc -l` -ge '1' ]
do
echo "Tomcat is still running..."
kill $(ps aux | grep '[L]ibrary/Java/Home/bin/java' | awk '{print $2}')
sleep 3
done
echo "Tomcat successfully stopped."
;;
*) /opt/tomcat/bin/startup.sh
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment