How do I run a cleanup script after a YAJSW wrapped Windows Service terminates?

大兔子大兔子 提交于 2019-12-13 04:59:35

问题


I have an Java jar that I've wrapped up with YAJSW for running on Windows. The service installs, starts and ends beautifully. Unfortunately, the jar leaves behind some files that muck up clean restarts. Before YAJSW, these files were cleaned up by a batch script. I have that same small script that cleans up those errant files. I've read over the documentation and configuration parameters for YAJSW and for the life of me, I can't find a clear explanation for how to get my cleanup script to run.

Excerpt from current wrapper.conf

wrapper.script.STOP=bin/stop_ic.gv

The cleanup script cited above doesn't seem to execute because the files are still around.

There are a couple of references to stopping Tomcat services with an extra conf file but when I read through those docs, it doesn't make sense to me what's happening. I've also found references to wrapper.stop.conf and wrapper.stopper but I don't know how to use those parameters.


回答1:


In the configuration parameters link, there's a large entry for 'wrapper.script..' listing out the various states and how to get scripts to execute when entering those states.

Also, getting the paths right to the script you want to run is important. Relative paths are from the root of the YAJSW folder (which I suppose is obvious but worth stating).

Edit: Removed assertion that shell/batch scripts couldn't be run. I'm not sure where I got that idea.



来源:https://stackoverflow.com/questions/26413442/how-do-i-run-a-cleanup-script-after-a-yajsw-wrapped-windows-service-terminates

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!