I can hit ctrl-c with the best of them. When I do this, I see a bunch of messages about things gone bad and then a window pops up wanting to know if I want to notify microsoft about my system problems.
I would like to make a batch file that I could put in my project called bounce.bat. It would tell tomcat to gracefully shutdown and block until tomcat was all done. Then it would call "ant deploy" - where I would pretty much delete everything in the tomcat webapps directory, then drop a fresh war file. Then it would start tomcat back up.
Here's one that I use. It does it the opposit way from what you just described (the ant script calls the shell/batch script) Like yourself, I feel more comfortable with a complete shutdown of Tomcat. Since I'm doing that, I never needed to install the ANT tasks for deploying.
This script probably does more than what you want so you'll have to weed out what's junk to you:
It:
Deletes the current copy of the application
Pulls the entire project from CVS to the scratch directory
Does some string replacement (version numbers, connection strings, etc)
Compiles all the Java classes (by calling nested build scripts)
Jars up all the class files and deletes the source (this removes the temptation to make a fix on the build server instead of doing in the developer's environment and checking it into CVS)
Packs everything into a war file.
Calls a shell script that restarts Tocmat
CD tomcat/bin ./shutdown.sh ./startup.sh
Sleeps for a while, giving tomcat a chance to wake up and deploy the new war file.
Moves some non-shipping files into directories within the app.
Says "done"
sample.build.xml I'm sure an ANT guru could show me better ways to do some of this stuff but it does what I need.
At least one of the tags was a problem for the forum software and it would have been too time consuming to figure out which so I provided a link to it instead.
For a winders box you just need to change the ./startup.sh to startup etc. Or... If you're running Tomcat as a service, you can use: net stop TOMCAT_SERVICE_NAME net start TOMCAT_SERVICE_NAME [ January 13, 2006: Message edited by: Ben Souther ]
You can get the service name by looking in the properties window from the services screen. I just looked on one of our windows boxes and it's "Tomcat5" [ January 13, 2006: Message edited by: Ben Souther ]
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
1
posted
0
I have a question about running shutdown.bat immediately followed by startup.bat Typically my Tomcat takes quite a while to go through the shutdown routine so I always wait till it vanishes from the processes list. Is it safe to start a new instance with startup.bat while the old one is still shutting down? Bill
I do it all the time with the shell scripts in Linix. The new one runs under a different process. I can't say for sure with Windows.
If it is a problem, you could always run the shutdown script, then build the project before calling startup. Or, use Ant's sleep task to insure that there is some time between the two.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.