1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| #!/usr/bin/bash
zip_passwd=`date +%b%d%Y` dump_folder=/dbback/data_pump ftp_name=/oradata/schedule/log/dba_ftp_ ftp_name_list=${ftp_name}_list ftp_ck_name=/oradata/schedule/log/dba_ftp_ck_ ftp_size_name=/oradata/schedule/log/dba_ftp_size_ ftp_reput_name=/oradata/schedule/log/dba_ftp_reput_
ls -ltr ${dump_folder} | grep ${zip_passwd} | tr -s ' ' | cut -d ' ' -f9 > ${ftp_name_list}
cat ${ftp_name_list} | while read line do echo 'user ftpuser ftppasswd' > ${ftp_name}${line}; echo 'bi' >> ${ftp_name}${line}; echo 'prompt' >> ${ftp_name}${line}; echo lcd ${dump_folder} >> ${ftp_name}${line}; echo put ${line} >> ${ftp_name}${line}; echo 'bye' >> ${ftp_name}${line}; done
cat ${ftp_name_list} | while read line do echo 'user ftpuser ftppasswd' > ${ftp_ck_name}${line}; echo dir ${line} >> ${ftp_ck_name}${line}; echo 'bye' >> ${ftp_ck_name}${line}; done
cat ${ftp_name_list} | while read line do ftp -n FTP_IP < ${ftp_name}${line}; ftp -n FTP_IP < ${ftp_ck_name}${line} > ${ftp_size_name}${line}; done
cat ${ftp_name_list} | while read line do ftp_sfile=`cat ${ftp_size_name}${line} | grep ${zip_passwd} | tr -s ' ' | cut -d ' ' -f5` local_sfile=`ls -ltr ${dump_folder} | grep ${line} | tr -s ' ' | cut -d ' ' -f5` if [ ${ftp_sfile} -gt 0 ] && [ ${ftp_sfile} -ne ${local_sfile} ]; then echo 'user ftpuser ftppasswd' > ${ftp_reput_name}${line}; echo 'bi' >> ${ftp_reput_name}${line}; echo 'prompt' >> ${ftp_reput_name}${line}; echo lcd ${dump_folder} >> ${ftp_reput_name}${line}; echo restart ${ftp_sfile} >> ${ftp_reput_name}${line}; echo put ${line} >> ${ftp_reput_name}${line}; echo 'bye' >> ${ftp_reput_name}${line}; ftp -n FTP_IP < ${ftp_reput_name}${line} ; fi done
|