Serv U out of service alternative solution of batch monitoring and running

  • 2020-05-09 19:39:59
  • OfStack

Recently, Serv-U was used to build the FTP server, a bridge for file transfer. It didn't last long. Every once in a while, the service of Serv-U stopped automatically. Because this ftp service is very important, to ensure that you can work normally every day, if you only rely on people to check whether the service is normal every day, do not mention the energy involved, it is not reliable. So, Google. There are various theories on the Internet, for example, FTP will automatically stop service due to heavy traffic, while Serv-U will automatically stop service due to heavy traffic. In summary, there is no reason why Serv-U is periodically out of service. We have no choice but to change our thinking: if we cannot find the reason why Serv-U periodically stops service, then we can detect that the service stops and automatically start Serv-U service after Serv-U service stops, which is also impossible.

Solution: execution plan + batch processing. Set up an execution plan to execute one batch task every 30 minutes. What batch does: read the list of processes to see if the Serv-U process exists; If the process does not exist, start the service and output the log.

Here's the batch implementation:

 
@echo off 
for /f "usebackq" %%i in (`"tasklist|find /c "Serv-U.exe""`) do ( 
set chkstat=%%i 
) 

if %chkstat% == 0 ( 
net start Serv-U 
echo ================ >> %date:~0,10%.log 
echo %date% %time% check Serv-U service stop >> %date:~0,10%.log 
echo restart Serv-U service! >> %date:~0,10%.log 
echo ================ >> %date:~0,10%.log 
) 


Version does not allow the program file name is not the same, we can also use this code, monitoring other programs. serv_u6 requires Serv-U.exe to be replaced by ServUDaemon.exe. You can check it out in tasklist. 1 must correspond to the exe file name and the service name.

Related articles: