Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DIR="/var/code/WPS"
- UPDATE=false
- DEPLOY=false
- RESTART=false
- BUILD=true
- TOMCAT="/etc/init.d/tomcat8"
- TOMCAT_USER="admin"
- TOMCAT_PASS="admin"
- MANAGER="http://localhost:8080/manager/html"
- # used for renaming of war file
- VERSION="3.6.2-SNAPSHOT"
- WEBAPP_NAME="wps"
- help() {
- echo >&2 "Usage $0 [-dnur] [-p directory] [-w name]"
- echo >&2 " -p directory path to the build directory [default: /var/code/WPS]"
- echo >&2 " -d deploy the webapp to the local tomcat [default: false]"
- echo >&2 " -n do NOT build the webapp (successful build required for deploy) [default: false]"
- echo >&2 " -u update the working copy [default: false]"
- echo >&2 " -r restart tomcat after deploying (implies -d) [default: false]"
- echo >&2 " -w name use \"name\" as the webapp name [default: wps]"
- exit 1
- }
- while getopts b:w:uhrd o 2>/dev/null; do
- case ${o} in
- p)
- DIR=${OPTARG}
- ;;
- d)
- DEPLOY=true
- ;;
- n)
- BUILD=false
- ;;
- u)
- UPDATE=true
- ;;
- w)
- WEBAPP_NAME=${OPTARG}
- ;;
- r)
- RESTART=true
- DEPLOY=true
- ;;
- *)
- help
- ;;
- esac
- done
- cd $DIR
- # update
- if $UPDATE; then
- echo "[SCRIPT] UPDATING REPO ..."
- git pull
- fi
- # undeploy
- if $DEPLOY; then
- echo "[SCRIPT] UNDEPLOYING ..."
- curl -vu "$TOMCAT_USER:$TOMCAT_PASS" "$MANAGER/undeploy?path=/$WEBAPP_NAME"
- fi
- # build
- if $BUILD; then
- echo "[SCRIPT] BUILDING PROJECT ..."
- # build w/o geotools
- #mvn clean install -DskipTests=true
- # build with geotools
- mvn clean install -DskipTests=true -Pwith-geotools
- # rename war file
- mv -v "52n-wps-webapp/target/52n-wps-webapp-$VERSION.war" "52n-wps-webapp/target/$WEBAPP_NAME.war"
- fi
- #deploy
- if $DEPLOY; then
- echo "[SCRIPT] DEPLOYING ..."
- curl -vu "$TOMCAT_USER:$TOMCAT_PASS" "$MANAGER/deploy?path=/$WEBAPP_NAME&war=`pwd`/52n-wps-webapp/target/$WEBAPP_NAME.war"
- # restart tomcat
- if $RESTART; then
- $TOMCAT restart
- fi
- fi
- cd -
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement