zoukankan      html  css  js  c++  java
  • ftp 上传和下载

    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
  • 相关阅读:
    ExtJs自学教程(1):一切从API開始
    c++多态的案例分析
    pig中使用的一些实例语法
    6.跑步者--并行编程框架 ForkJoin
    移动加密那点事儿_值存储加密
    手工制作的年份Java老A发售量
    【C语言的日常实践(十六)】字符串输出功能puts、fputs和printf
    POJ 1852 Ants
    HDU 4793 2013 Changsha Regional Collision[简单的平面几何]
    BZOJ 1355 Baltic2009 Radio Transmission KMP算法
  • 原文地址:https://www.cnblogs.com/xiluhua/p/10368718.html
Copyright © 2011-2022 走看看