Skip to content

Instantly share code, notes, and snippets.

@scottsbaldwin
Created January 18, 2012 21:59
Show Gist options
  • Save scottsbaldwin/1636069 to your computer and use it in GitHub Desktop.
Save scottsbaldwin/1636069 to your computer and use it in GitHub Desktop.
Deploy script for a war on tomcat 6
#!/bin/bash
if [ "$1" == "" ]
then
echo "Usage: $0 [dir]"
exit 1
fi
if [ ! -e "$1/MYWAR.war" ]
then
echo "$1/MYWAR.war does not exist!"
exit 1
fi
TOMCAT=/usr/share/apache-tomcat-6.0.32
echo "Stopping tomcat..."
sudo /etc/init.d/tomcat stop
# make sure tomcat has fully stopped
sleep 5
echo "Removing existing web app"
sudo rm -rf ${TOMCAT}/webapps/MYWAR ${TOMCAT}/webapps/MYWAR.war
echo "Copying $1/MYWAR.war to ${TOMCAT}/webapps"
cp $1/MYWAR.war ${TOMCAT}/webapps
echo "Starting tomcat"
sudo /etc/init.d/tomcat start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment