窗口服务自动重启现有的tomcat服务

时间:2021-04-12 16:56:34

Is there any utility / maybe use window scheduler to auto restart "tomcat6 service" everyday? any guideliness on this?

是否有任何实用程序/可能使用窗口调度程序每天自动重启“tomcat6服务”?对此有何指导?

My tomcat service is installed using javaservice.exe .

我的tomcat服务是使用javaservice.exe安装的。

2 个解决方案

#1


window scheduler to auto restart "tomcat6 service"

窗口调度程序自动重启“tomcat6服务”

  • First of all create 2 different bat files :
  • 首先创建2个不同的bat文件:

1. Tomcat_start.bat

@echo off
net Start tomcat6

2. Tomcat_stop.bat

@echo off
net stop tomcat6

Reason to create two different bat file is: give 1-5 min time to stop service completely otherwise service cannot start.

创建两个不同的bat文件的原因是:给1-5分钟时间完全停止服务,否则服务无法启动。

Scheduler Image : 窗口服务自动重启现有的tomcat服务

调度图像:

As you can see in image create two different scheduler, one for stop and one for start. I have provided 15 min time between stop and start. you can give 3-5 min(this is minimum required time to stop service completely if any heavy load).

正如您在图像中看到的那样,创建两个不同的调度程序,一个用于停止,一个用于启动。我在停止和开始之间提供了15分钟的时间。你可以给3-5分钟(这是任何重负荷完全停止服务所需的最短时间)。

Note:
1. As you can see in image give Run with highest Privileges checked true and also change Run Whether user is logged on or not.
2. Set your bat file in actions tab and set time in Triggers tab.

注意:1。如您在图像中看到的那样,将“最高权限运行”选中为“运行”,并更改“运行”是否登录用户。 2.在操作选项卡中设置bat文件,并在“触发器”选项卡中设置时间。

#2


You can schedule a batch file with: net stop YourService net start YourService

您可以使用以下命令安排批处理文件:net stop YourService net start YourService

Rod

#1


window scheduler to auto restart "tomcat6 service"

窗口调度程序自动重启“tomcat6服务”

  • First of all create 2 different bat files :
  • 首先创建2个不同的bat文件:

1. Tomcat_start.bat

@echo off
net Start tomcat6

2. Tomcat_stop.bat

@echo off
net stop tomcat6

Reason to create two different bat file is: give 1-5 min time to stop service completely otherwise service cannot start.

创建两个不同的bat文件的原因是:给1-5分钟时间完全停止服务,否则服务无法启动。

Scheduler Image : 窗口服务自动重启现有的tomcat服务

调度图像:

As you can see in image create two different scheduler, one for stop and one for start. I have provided 15 min time between stop and start. you can give 3-5 min(this is minimum required time to stop service completely if any heavy load).

正如您在图像中看到的那样,创建两个不同的调度程序,一个用于停止,一个用于启动。我在停止和开始之间提供了15分钟的时间。你可以给3-5分钟(这是任何重负荷完全停止服务所需的最短时间)。

Note:
1. As you can see in image give Run with highest Privileges checked true and also change Run Whether user is logged on or not.
2. Set your bat file in actions tab and set time in Triggers tab.

注意:1。如您在图像中看到的那样,将“最高权限运行”选中为“运行”,并更改“运行”是否登录用户。 2.在操作选项卡中设置bat文件,并在“触发器”选项卡中设置时间。

#2


You can schedule a batch file with: net stop YourService net start YourService

您可以使用以下命令安排批处理文件:net stop YourService net start YourService

Rod