• 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
  • 相关阅读:
    04:布尔表达式
    python中的operator模块
    python习题-4
    北大OJ1001
    [工具]toolbox_graph_laplacian
    [工具]toolbox_graph_normal_displayment
    [工具]toolbox_graph_isomap
    [工具]toolbox_graph_建立欧式距离邻接矩阵
    [工具]toolbox_graph_Floyd算法
    [工具]toolbox_graph_dijkstra算法
  • 原文地址:https://www.cnblogs.com/xiluhua/p/10368718.html
Copyright © 2020-2023  润新知