linux自动ftp上传与下载文件的简单脚本

 

#!/bin/sh

cd /data/backup/55mysql

DATE=`date +'%Y%m%d'`
file="55_mysql_"$DATE"03*.rar"
file1="55_mysql_"$DATE"0302.rar"
file2=55_mysql_"$DATE"1500.rar
file3=55_mysql_"$DATE"15*.rar
ftpuser="123"
ftppasswd="123"

if [ ! -f ./"$file1" ]  ;then
ftp -i -in << !
open 192.168.1.11 221
user $ftpuser $ftppasswd
bin
mget $file
bye
!
else
sleep 1
fi

if [ ! -f ./"$file2" ]  ;then
ftp -i -in << !
open 192.168.1.11 221
user $ftpuser $ftppasswd
bin
mget $file3
bye
!
else
sleep 1
fi

posted @ 2014-11-18 13:53  牛不烦  阅读(565)  评论(0编辑  收藏  举报