#!/usr/bin/sh #此脚本放在/kior/domains10/kiorapp/shellDir/upLoadFileTo/ 路径下 #本地路径 LDIR="/kior/domains10/kiorapp/tmp/needBak/backFile/" #目标路径 RDIR="/kiordata/interface/WebTrade/input" RHOST="192.168.8.32" USER="ftpbatch" PASSWD="ftpbatch" UPFILE=$1 FLAG="" cd $LDIR FtpSend( ) { ftp -ivn $RHOST <<EOF user $USER $PASSWD cd $RDIR bin prompt put $UPFILE quit EOF } LOOP=1 while [ $LOOP -le 5 ] do RET=`FtpSend` FLAG=`echo "$RET"| grep -w "226" |awk -F' ' '{print $1}'` if [ "$FLAG" = "226" ]; then echo $FLAG exit 0 elif [ $LOOP -eq 5 ]; then echo "OVER" fi LOOP=$(( $LOOP + 1 )) done exit -1
转载于:https://blog.51cto.com/laobaiv1/1899444