Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to setup an update process for an application running on Tomcat. The server which hosts tomcat is only open during working hours (it is an intraner application for a small company). I was thinking that I could upload the new war to the server and set up "something" to run on the next server boot. This something could be a bat file that will be executed on server start up but before the start up of the Tomcat service and it will delete the old war and its exploded folder. When I update manually the war I also delete the work folder of Tomcat (just to be sure). I know about hot deployment but I do not consider it an option since I am not very sure for the implications it might have on the users current working sessions.

Is there a way to run such a bat file before Tomcat start up or an alternative way to do this update? Tomcat version isn't an issue. Now is running Tomcat 6 but I can upgrade to version 7 if needed.

share|improve this question
up vote 0 down vote accepted

The way I would set it up is by not having tomcat auto start on start up of the server but simply call the startup.bat/.sh file (located in the tomcat/bin folder) at the end of the script that replaces the war file (and that is run at startup of the server).

share|improve this answer
You may have a point. Since I want to run Tomcat the proper way as a service, I could disable the automatic start up of the service when I upload the war and then in the end of the script I could start the service and reset it to automatic. – pater Apr 12 '12 at 10:55
Or keep tomcat as a service, have the script that replaces the war file and then restart tomcat (that will cause tomcat to re-read the war file and re-deploy it). I have cheated that way once or twice when re-uploading updated war files (or a new ROOT app) – Jontas Apr 12 '12 at 11:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.