问题
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