Phate
Phate

Reputation: 6622

How to restart tomcat application when a file change?

I have an application represented by an exploded .war:

/webapps/myWebapp

Usually, when the .war is present, I do the following via command line:

touch /webapps/myWebapp.war

This changes the last modification date on the war, making the tomcat redeploy the application inside of its folder: the old folder is deleted and a new one is created again.

Unfortunately I don't have the .war, but only the application folder and, sometimes, I need to change some files inside of it and a restart is requested in order for the changes to take effect.

Is there a similar way to accomplish the same without restarting the whole tomcat server? Alternatively I could do that via the manager console...the problem is that I want my user to be able to only restart that application, not every single application deployed.

Can you give me some hints/suggestions? Thanks

Upvotes: 2

Views: 928

Answers (1)

Suresh Atta
Suresh Atta

Reputation: 122026

You may want to look at the property WatchedResource

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

WatchedResource - The auto deployer will monitor the specified static resource of the web application for updates, and will reload the web application if is is updated. The content of this element must be a string.

Just add paths of the files that you want to see the changes.

Upvotes: 2

Related Questions