Skip to content

Instantly share code, notes, and snippets.

@mieky
Created December 19, 2012 10:45
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 mieky/4335874 to your computer and use it in GitHub Desktop.
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)
#!/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