Recently used serv-u to set up an FTP server for file transfer of the bridge. Not long, every once in a while, Serv-u service will automatically stop. Because this FTP service is very important, to ensure that the normal work every day, if only rely on people every day to see whether the service is normal, involved in energy does not say, is not very reliable. So, Google's. All kinds of sayings on the Internet, such as FTP in the case of large traffic, Serv-u will automatically stop service because of busy. In short, the reason for serv-u to stop service periodically is not found. No way, had to change the train of thought: Unable to find the cause of Serv-u periodic stop service, then the Serv-u service can detect the service stop automatically start Serv-u service, this scheme is also to try.
Scenario: Execution plan + batch processing. Set up the execution plan to perform a batch task every 30 minutes. What a batch does: Read the process list to see if the serv-u process exists, and if the process does not exist, start the service and output the log.
Here is the batch implementation section:
Copy Code code as follows:
@echo off
for/f "Usebackq"%%i in (' "Tasklist|find/c" Serv-u.exe "") Does (
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 of the program file name is not the same, we can also use this code to monitor other programs. The SERV_U6 version needs to replace Serv-u.exe with ServUDaemon.exe. You can see it in the tasklist. Be sure to correspond to the EXE filename, with the service name.