|
FTP batch ...
FTP
commands for batch files
You can run FTP commands in a batch file with the
command
ftp
-s:filename
Create a .txt file with the FTP commands, one command
per line.
open
<hostname>
<FTP user>
<FTP password>
hash
# display progress
bin
# copy in binary mode (or asc for Ascii)
lcd <local folder> # change
local directory
cd <remote folder> # change
directory on FTP server
get <remote file> #
copy file to local directory
bye Example file download_logfiles.txt: open
www.mydomain.com
john
moNkey77
hash
asc
lcd c:\temp
cd statistics/logs
get access_log
bye Now you can start the download from the command line
with the following command: ftp
-s:download_logfiles.txt
Check
the
FTP
port in
regular intervals
If you would like to check your FTP Server at regular
intervals, you can use the command line utility SLCheck.
SLCheck connects to the FTP Server and checks the answer. Batch
files can be executed in dependance of the result, e.g. to send
alarm notifications. Try the following command:
SLCheck
-p 21 -a ftp.domain.com -r "220 ProFTPD"
220 ProFTPD
can be the normal answer from a FTP Server.
All results are logged in a logfile. You can monitor your FTP Server by running SLCheck as a scheduled task, e.g. once a minute.
SLCheck Homepage
|