In the company's FTP server, SERVU services are often automatically offline, each time need to manually go to a bit of trouble.
Then write a script to set the scheduled task to check the status of the FTP service and restart the service.
Ideas:
Set a scheduled task: Use the FTP command to connect to the FTP upload file, and then detect if the file is uploaded successfully, if the upload successfully logs success information to the log file. If the upload fails, the FTP service is abnormal, the associated FTP process is killed, the process information is logged, and the associated program is restarted.
Details:
1, use the ping command to do a simple delay check.
2. Scheduled tasks need to set the execution timeout stop task, because bat does not stop automatically after other programs are called. (should be able to be set)
===================main.bat================================================================
@echo off
CD/D C:\ftpmonitor
If exist "C:\ftpmonitor\aa\success.txt" del "C:\ftpmonitor\aa\success.txt"
Call Startftp.bat
Ping-n 127.0.0.1 > NUL
If exist "C:\ftpmonitor\aa\success.txt" (Echo%date:~0,10%%time% success >> Log.txt & Exit)
Taskkill/fi "IMAGENAME eq servu*"-F
echo%date:~0,10%%time% call Servu >> log.txt
"C:\Program Files\rhinosoft.com\serv-u\servuadmin.exe"
Exit
===================main.bat================================================================
===================startftp.bat============================================================
Ftp-n-s:file.txt
===================startftp.bat============================================================
===================file.txt================================================================
Open IP Port
User username
Password
Bin
Prompt
Put Success.txt
Bye
Exit
===================file.txt================================================================
Monitor FTP service status and automatically restart SERVU