简体   繁体   English

如何自动启动apache tomcat服务器

[英]How to auto start apache tomcat server

I can view the webpage after deploying the war file.when i open the page for next day i cannot view the page again after restarting the apache tomcat server the page opens.我可以在部署 war 文件后查看网页。当我打开第二天的页面时,我无法在重新启动 apache tomcat 服务器后再次查看页面,页面打开。

You must have shut down the machine. 您必须关闭机器。 When you come on next day and access the same URL then you won't be able to see that page. 当您第二天到访并访问相同的URL时,将无法看到该页面。 You will have to restart the tomcat server again to see that page. 您必须再次重新启动tomcat服务器才能看到该页面。

I assume you use Linux and encountered the same issue when security patches/ OS hardening is performed on the server where apache tomcat runs.我假设您使用Linux并且在运行 apache tomcat 的服务器上执行安全补丁/操作系统加固时遇到相同的问题。 Below is the way I tackled the problem starting tomcat right after server reboots.以下是我在服务器重新启动后立即解决启动 tomcat 问题的方法。

You will need to use CronScheduler and is pretty easy.您将需要使用CronScheduler并且非常简单。 The Cron daemon is a built-in Linux utility that runs processes on your system at a scheduled time. Cron 守护程序是一个内置的 Linux 实用程序,可在计划的时间在您的系统上运行进程。

Open a Terminal
Type --> crontab –e
Add following Line into Crontab --> @reboot [path to tomcat`s startup.sh shell script in tomcat`s bin directory]
Press ESC key and Press ':' and Type "wq" (Save the changes into Cron via VIM/ VI)
Type crontab -l (This will show you the reboot statement added means all OK) 

The job defined by this string runs at startup, immediately after Linux reboots.此字符串定义的作业在启动时运行,在 Linux 重新启动后立即运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM