Answer the question
In order to leave comments, you need to log in
How to organize a service restart in case of a crash?
I have a web service that manages to crash every few days. If this happens, I'm fine with its automatic restart. I tried the following solution:
@echo off
:startover
echo (%time%) App started.
call ".\bin\server.exe"
echo (%time%) WARNING: Restarting.
goto startover
Answer the question
In order to leave comments, you need to log in
Did this. The script "launching the program if it is not running powershell" is googled for one or two, and it takes two minutes to fasten the logic to correctly finish off the hung service.
In general:
1. Check if the process is running;
2. If not, then check the port;
3. If the port is not closed, then simply restart the service;
4. If the port is closed, then we finish off the remnants of the service and restart.
In theory, if the service falls, then it releases the port.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question