Monitor FTP service status and automatically restart SERVU

Source: Internet
Author: User
Tags ftp upload file

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.