ftp 下载
#!/bin/bash #auth liwei #date 20190130 DATE=$(date -d today +%Y%m%d) #data files path SRCDIR=/home/weblogic/syn/antgroup DIR_DATA=$SRCDIR"/data/" echo "DIR_DATA: "$DIR_DATA #logs path DIR_LOG=$SRCDIR"/logs/" echo "DIR_LOG: "$DIR_LOG log_file=${DIR_LOG}$DATE"_apply".log # init dir if [ ! -d ${DIR_DATA} ]; then mkdir -p ${DIR_DATA} fi if [ ! -d ${DIR_LOG} ]; then mkdir -p ${DIR_LOG} fi #init file if [ ! -d $log_file ]; then touch $log_file fi echo 'log_file: '$log_file #srouce file name SFILE=continuous_apply.zip #local file name LFILE=$DATE-apply.zip cd ${DIR_DATA} #if exist so exit . if [ -f ${LFILE} ]; then echo $LFILE" already download "$(date +%Y%m%d' '%H:%M:%S) >> $log_file exit fi #FTP path DESDIR=/download/continuous/${DATE}"00" #ant IP IP=110.75.228.31 #port PORT=22 #user USER=tprsdownload #ant pwd PASSWORD=EACJQU #get file of ant lftp -u ${USER},${PASSWORD} sftp://${IP}:${PORT}<<EOF cd ${DESDIR} lcd ${DIR_DATA} get ${SFILE} by EOF cd ${DIR_DATA} if [ -f $SFILE ]; then echo $SFILE" download is ok !!!!!!!!!!!!!!! "$(date +%Y%m%d' '%H:%M:%S) >> $log_file mv ${SFILE} ${LFILE} echo $SFILE" rename to " $LFILE $(date +%Y%m%d' '%H:%M:%S) " ok!!!!!!" >> $log_file else echo $SFILE" download fail..... "$(date +%Y%m%d' '%H:%M:%S) >> $log_file fi
ftp 上传
#!/bin/bash #auth liwei #date 20190130 DATE=$(date -d today +%Y%m%d) #data files path SRCDIR=/home/weblogic/syn/antgroup DIR_DATA=$SRCDIR"/data/" echo "DIR_DATA: "$DIR_DATA #logs path DIR_LOG=$SRCDIR"/logs/" echo "DIR_LOG: "$DIR_LOG log_file=${DIR_LOG}$DATE"_apply".log # init dir if [ ! -d ${DIR_DATA} ]; then mkdir -p ${DIR_DATA} fi if [ ! -d ${DIR_LOG} ]; then mkdir -p ${DIR_LOG} fi #init file if [ ! -d $log_file ]; then touch $log_file fi echo 'log_file: '$log_file #srouce file name SFILE=continuous_apply.zip #local file name LFILE=$DATE-apply.zip cd ${DIR_DATA} #if exist so exit . if [ -f ${LFILE} ]; then echo $LFILE" already download "$(date +%Y%m%d' '%H:%M:%S) >> $log_file exit fi #FTP path DESDIR=/download/continuous/${DATE}"00" #ant IP IP=110.75.228.31 #port PORT=22 #user USER=tprsdownload #ant pwd PASSWORD=EACJQU #get file of ant lftp -u ${USER},${PASSWORD} sftp://${IP}:${PORT}<<EOF cd ${DESDIR} lcd ${DIR_DATA} get ${SFILE} by EOF cd ${DIR_DATA} if [ -f $SFILE ]; then echo $SFILE" download is ok !!!!!!!!!!!!!!! "$(date +%Y%m%d' '%H:%M:%S) >> $log_file mv ${SFILE} ${LFILE} echo $SFILE" rename to " $LFILE $(date +%Y%m%d' '%H:%M:%S) " ok!!!!!!" >> $log_file else echo $SFILE" download fail..... "$(date +%Y%m%d' '%H:%M:%S) >> $log_file fi