Created
December 19, 2012 10:45
-
-
Save mieky/4335874 to your computer and use it in GitHub Desktop.
A helper script for deploying a WAR file to a local Tomcat container (with Manager & JMX enabled in tomcat-users.xml for username/password)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 1 ]; | |
then | |
echo "This script deploys a WAR file to a local Tomcat container." | |
echo "Usage: $0 <war_file>" | |
exit 1 | |
fi | |
WAR_FILE=$1 | |
if [ ! -f $WAR_FILE ]; | |
then | |
echo "Application archive not found: $WAR_FILE" | |
exit 1 | |
fi | |
echo "Deploying..." | |
curl -s -T - -u username:password 'http://localhost:8080/manager/text/deploy?update=true&path=/' < $WAR_FILE | |
RETVAL=$? | |
if [ $RETVAL -eq 0 ]; | |
then | |
echo "Successfully deployed!" | |
else | |
echo "fail (exit code $RETVAL)" | |
fi | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment