bash 如何在tomcat服务器中重新启动应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19367121/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to restart application in tomcat server
提问by Shan Ali
I have been looking for some solution to restart app inside tomcat server on remote linux machine but i haven't found anything yet.
我一直在寻找一些解决方案来在远程 linux 机器上的 tomcat 服务器内重新启动应用程序,但我还没有找到任何东西。
Can anyone please tell me how can i restart the application in Tomcat Server after some time interval without restarting the tomcat server on remote machine?
任何人都可以告诉我如何在一段时间间隔后重新启动 Tomcat 服务器中的应用程序而不重新启动远程机器上的 tomcat 服务器?
Can anyone help me out with the Bash Script and CRON Job?
谁能帮我解决 Bash 脚本和 CRON 作业?
回答by Manolo Carrasco Mo?ino
. First configure your tomcat to enable access to the manager application (follow these steps)
. 首先配置您的 tomcat 以启用对管理器应用程序的访问(按照以下步骤操作)
. Then test that everything works well from a browser going to the url
. 然后测试从浏览器转到 url 一切正常
http://your_server_url:8080/manager/reload?path=/your_app_context
[EDITED] If your version of Tomcat is 7 or above the url must be:
http:// your_server_url:8080/manager/text/reload?path=/your_app_context
. Do the same from command line using wget
o curl
. 使用wget
o从命令行执行相同操作curl
wget -O - http://your_server_url:8080/manager/reload?path=/your_app_context
. Finally edit your crontab (run crontab -e) and set something like this:
. 最后编辑您的 crontab(运行 crontab -e)并设置如下:
# run each day at 01:00
0 1 * * * wget -O - http://your_server_url:8080/manager/reload?path=/your_app_context >/dev/null 2>&1