It’s ruby, so you could technically use Thread.sleep in your recipe but I think using timing is a really sloppy way to do it, as really you don’t know how long it would take for tomcat to do the stuff that you are waiting for because the machines you deploy on could have wildly different specs (memory, CPU speed, etc); your script would not be reliable or completely predictable.
If you must explode the war and modify the files after, you could try the subscribe mechanism when the tomcat service restarts :
service “tomcat” do
supports :restart => true, :reload => true
subscribes :reload, resources(:template => “/tmp/somefile”), :immediately
However it’s not completely clear to me if this is even supported any more (see ‘Notifications’ in http://wiki.opscode.com/display/chef/Resources)
Finally, you could poll the file system in a loop (with a delay of course - don’t make a busy wait!) for the file you want to change, then when it appears change it.
IMHO, all of the above options are a kludge and should be avoided in favor of external configuration.
On Jul 29, 2011, at 10:43 AM, Mani Govindarajulu wrote:
Thanks Nathan, i understand we could change that any config make it as external and restart the service , that really would resolve us.
But is there any solution if any scenario comes like this .
On Fri, Jul 29, 2011 at 8:57 AM, Nathan Pahucki firstname.lastname@example.org wrote:
Sounds like things may be fundamentally setup wrong. Perhaps you should externalize whatever configuration you want to change so that you don’t need to explode the wars at all. If the configuration is external to the war then chef will have no problem writing these files and tomcat can be re/started after the files are written. You have several options with tomcat for externalization; you could use properties files that your app reads from the home directory, or you can use environment configuration specifying values in a context.xml, or an external applicationConfig.xml if you are using Spring.
If you can’t externalize, please explain why so we can help you think of other solutions.
Enviado desde mi iPad
El Jul 29, 2011, a las 1:51, email@example.com escribió:
I am having one scenario in the tomcat deployment .
Putting the 3 wars file in the web apps and start the tomcat . this will
extract the folder.
After that i need to stop the service and then reconfigure the generated
application folder config file and then start it again
The issue extracting war file to folder is taking some much time so that stop
service stopped the tomcat and rest of war files couldn’t able to extract so
reconfiguration action could not able to to because war extraction would not
been done fully.
Is there any thing i can wait for some time and then do rest of operations.
or Any operation wait till it completes? (this wont help)
Thanks & Regards