Created
September 5, 2014 23:01
-
-
Save egermano/810b1d82611fbbaca9ee to your computer and use it in GitHub Desktop.
Tool to start dynamically tomcat
This file contains 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 | |
# limpa a pasta antiga | |
rm -rf ~/Sites/apache-tomcat-6.0.37/work/Catalina/localhost/ | |
FOLDER=$(pwd) | |
LocalHostFolder="~/Sites/apache-tomcat-6.0.37/conf/Catalina/localhost/" | |
ROOTFile=$LocalHostFolder"ROOT.xml" | |
XMLTemplate="<Context docBase=\"$FOLDER/web\" path=\"\"> | |
</Context>" | |
if [ -z "$1" ]; then | |
echo "$(date +"%T") :: Simple start." | |
source "$(~/Sites/apache-tomcat-6.0.37/bin/catalina.sh jpda run)" | |
else | |
if [ -f $ROOTFile ]; then | |
echo "$(date +"%T") :: Rename de ROOT.xml to create new." | |
mv $ROOTFile "$ROOTFile.$(date +%Y%m%d%H%M%S)" | |
fi | |
echo $XMLTemplate > $ROOTFile | |
echo "$(date +"%T") :: New ROOT.xml has been created." | |
cat $ROOTFile | |
echo "$(date +"%T") :: Tomcat start." | |
source "$(~/Sites/apache-tomcat-6.0.37/bin/catalina.sh jpda run)" | |
fi | |
open "http://localhost:8080/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment