在 YAJSW 包装的 Windows 服务终止后,如何运行清理脚本? [英] How do I run a cleanup script after a YAJSW wrapped Windows Service terminates?

查看:35
本文介绍了在 YAJSW 包装的 Windows 服务终止后,如何运行清理脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 YAJSW 打包的 Java jar,可以在 Windows 上运行.该服务的安装、启动和结束都很漂亮.不幸的是,jar 留下了一些文件,这些文件会破坏干净的重启.在 YAJSW 之前,这些文件是由批处理脚本清理的.我有清理那些错误文件的相同小脚本.我已经阅读了 documentation配置参数 对于 YAJSW 和我的一生,我找不到有关如何运行清理脚本的明确解释.

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.

摘自当前的 wrapper.conf

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.

有几个参考文献提到使用额外的 conf 文件停止 Tomcat 服务,但是当我通读这些文档时,对我来说发生的事情没有意义.我还发现了对 wrapper.stop.conf 和 wrapper.stopper 的引用,但我不知道如何使用这些参数.

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.

推荐答案

在配置参数链接中,有一个很大的wrapper.script.."条目,列出了各种状态以及在输入这些状态时如何让脚本执行状态.

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.

此外,获取要运行的脚本的正确路径也很重要.相对路径来自 YAJSW 文件夹的根目录(我认为这很明显但值得说明).

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).

删除了无法运行 shell/批处理脚本的断言.我不确定我是从哪里得到这个想法的.

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

这篇关于在 YAJSW 包装的 Windows 服务终止后,如何运行清理脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆