cancel
Showing results for 
Search instead for 
Did you mean: 

BO4 - possible to restart tomcat automatically if tomcat stopped

former_member272336
Participant
0 Kudos

Hi,

Is it possible to have a windows based script which looks to see if tomcat stopped and restarts automtically if in stopped state between certain hours?

Any examples or downsides to this?

Occasionally we see tomcat in stopped state and restart manually as it has crashed.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can also specify in Windows Services, on the Recovery tab, to automatically restart the service if it quits unexpectedly.

former_member272336
Participant
0 Kudos

Thanks for suggestions.

Re the recovery tab - had a look at that - is there an option within this can say only do this between certain hours

e.g we deliberately stop tomcat daily via scripts at 2.00 .a.m and restart at 4.00 a.m - this is when etl running and backups take place so if tomcat stopped via this script wouldn't want it to start again automatically but would at all other times.

former_member185603
Active Contributor
0 Kudos

In your case, scripts approach is better option or if your organization has any 3rd party tools.

former_member272336
Participant
0 Kudos

Thanks for reply.

Former Member
0 Kudos

I believe that option only kicks in when the service fails or quits unexpectedly, if you manually stop it should not be automatically restarted.

http://superuser.com/questions/820527/how-to-force-a-windows-service-failure-to-test-its-recovery-se...

Former Member
0 Kudos

HI Brian,

I believe above script should work because what you are doing is this script will check the service if it is running or not. You terminate it manually or automatically it get killed. If found that the service is not running then it will start the service.This script will be running automatically in background with task scheduler.

If you wanted a proper script you can check "AutoHotKey Software" and simply create a proper script. This software then convert the  script to .exe and simply run it.

hope this will help.

Regards,

Mahak

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Philip,

You can use Simple BAT file to check and start the Service not only tomcat but any service.

In this case Default Tomcat Service Name is : BOEXI40Tomcat or you can check the services.msc .

Below is the sample script :

Try:

net start | find "servicename" > nul 2>&1

if not .%errorlevel%.==.0. goto startservice

goto skip

:startservice

net start "servicename"

echo service restarts @ %date% %time% >> C:\checklog.txt

:skip pause

Hope this will help.

regards,

Mahak

former_member272336
Participant
0 Kudos

Thanks for the  reply.

shankarsgs
Contributor
0 Kudos

Hi Philip.

you can use a simple batch script/program or use a third party Monitoring tool to do the same. Please refer this blogs for a similar idea.

Regards

Shankar

0 Kudos

Hi,

i cant provide you any proven Details but what i know is that a lot of customers are using all Kind of 3rd Party Monitoring Tools for that. If a .exe crashes, the Monitoring Tool restarts it.

So basically yes, this is possible.

Regards

-Seb.

former_member272336
Participant
0 Kudos

Thanks for update