Skip to content

Instantly share code, notes, and snippets.

@jamesnguyen101
Created March 15, 2015 16:34
Show Gist options
  • Save jamesnguyen101/27438f371c662908bec2 to your computer and use it in GitHub Desktop.
Save jamesnguyen101/27438f371c662908bec2 to your computer and use it in GitHub Desktop.
#!/bin/sh
TOMCAT_HOME="/opt/yosport/yosport_app/tomcat8"
TOMCAT_USER=root
#all app name that start with yo prefix
app_name="yo*"
# stop tomcat if it is running
TOMCAT_PID=`ps -ef | grep "$TOMCAT_HOME/" | grep 'Bootstrap start$' | awk '{print $2}'`
if [ ! -z $TOMCAT_PID ] ; then
echo "Tomcat still be running with PID $TOMCAT_PID."
# stop tomcat
su - $TOMCAT_USER -c "$TOMCAT_HOME/bin/catalina.sh stop 5 -force "
fi
## clear file & dir temp
echo "Remove [templ/*] dir"
rm -rf $TOMCAT_HOME/temp/*
echo "Remove [work/*] dir "
rm -rf $TOMCAT_HOME/work/Catalina
echo "Remove [logs/*] files"
rm -rf $TOMCAT_HOME/logs/*
echo "Removing [$app_name] dir and war file "
rm -rf $TOMCAT_HOME/webapps/$app_name
rm -rf $TOMCAT_HOME/webapps/$app_name.war
rm -rf $TOMCAT_HOME/logs-*
echo "Remove [~/.jrebel] dir "
rm -rf ~/.jrebel/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment