FTP自動上傳文件和自動下載文件腳本

1、自動從ftp服務器下載當天指定文件腳本:bash

#!/bin/bash 
ftp -nv 1.2.3.4 <<!FTPRUN
user bossftp 123456 
prompt 
bin 
cd abc 
lcd /data/abc/
get Afile$(date +%Y%m%d).txt
get Vfile$(date +%Y%m%d).txt
bye 
!FTPRUN

crontab腳本服務器

#每個月21日,25日9點執行
0 9 21,25 * * /data/getfile.sh >>/var/log/getftpfile.log 2>&1

2、自動上傳當天文件到ftp服務器腳本:日誌

#!/bin/bash 
ftp -nv 1.2.3.4 <<!FTPRUN
user bossftp 123456 
prompt 
bin 
cd upfile
lcd /data/upfile
put H-file_$(date +%Y%m%d).txt
put H-state_$(date +%Y%m%d).txt
bye 
!FTPRUN

crontab腳本code

#每個月1日2點執行putfile腳本,並記錄日誌
0 2 1 * * /data/upfile/putfile.sh >>/var/log/putfile.log 2>&1
相關文章
相關標籤/搜索