Implementation code:
#!/bin/bash #ftime0 =$ (ll/root/hbshell/down.txt | awk ' {print $} ') #ftime1 =$ (ll/root/hbshell/down.txt | awk ' {print $}
') touch/root/hbshell/down.txt while:do if [[/root/hbshell/down.txt-nt/root/hbshell/down_cp.txt]] then User=root passwd=19871022 host=192.168.1.202 dir=/tmp/down/$ (date +%y%m%d)/$ (date +%h%m) mkdir-p $dir cd $dir #cat/root/hbshell/d Own.txt|sed-e ' s#^ */## '-e ' s# *## '-e ' s#^[^a-za-z]*## ' >/root/hbshell/zdown.txt cat/root/hbshell/down.txt|sed ' s#^ [^a-za-z]*## ' >/root/hbshell/zdown.txt declare-a gg= ($ (cat/root/hbshell/zdown.txt)) Declare-i I for ((i=0;i<${# gg[@]};i= $i + 1)) do echo ${gg[$i]}|grep-q "/" If Echo $?| Grep-q 0 Then tmpdir=$ (Echo ${gg[$i]} | sed ' s#\ (. */\) (. *$\) #\1# ') mkdir-p./$tmpdir fi done/usr/bin/ftp-i-in &L
t;<!
Open $host user $user $passwd bin Mget $ (echo ${gg[@]}) bye! Declare-i J Declare-i Num num=0 for ((j=0;j<${#gg [@]};j= $j + 1)) doing if [[F $ (Echo ${gg[$j]}]] then ls-l $ (ech o ${gg[$j]}) num= $num +1 Else echo-e "\033[31m File ${gg[$j]} not down!! \033[0m "fi done Echo", "That's Files all down, Total is $num" \cp/root/hbshell/down.txt/root/hbshell/down_cp.txt fi D One
The above is the Linux Automation download and detect FTP file backup implementation code, need friends can refer to, if there are server permissions, personal recommendations to use rsync