Richie
Richie

Reputation: 5189

How to run a deployment task on application deployment and application start

I have a war file that I deploy using the websphere console. Everytime a new version of the application is deployed or the application is started I would like to delete some files in a websphere log directory on my linux filesystem.

i.e. 
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/mySubFolder

I would like peoples thoughts on what the right way to do this is.

I have heard of jacl scripts before but don't know if I should be heading in that direction. Also if I do go down the jacl script path can I write a jacl script for a war or does it have to be an ear?

thanks

Upvotes: 0

Views: 71

Answers (1)

skegg99
skegg99

Reputation: 415

You could probably configure ServletContextListener in your web.xml.

<web-app ...>
   <listener>
    <listener-class>
             com.example.MyServletContextListener 
        </listener-class>
   </listener>
</web-app>

MyServletContextListener.contextInitialized(...) will be called every time application is started. Of course websphere process will need permissions to delete those files.

Upvotes: 1

Related Questions