zoukankan      html  css  js  c++  java
  • shell----ftp推送

    运用shell操作ftp

    #!/bin/bash
    ##author  qicongliang
    date=`date "+%Y%m%d"`
    date2=`date "+%Y-%m-%d %H:%M:%S:"`
    
    echo "###########################################################$date2#######################################################################"  >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
    for file in `find /home/gzdssapp/peizhi/cloud_image/visible/$date -type f -mmin -10`    #搜索目录下最近十分钟更新的文件
      do
        file_name=${file##*/}                       #从文件路径中获取文件名
        ftp -in << EOF
        open 10.12.13.30
        user gzdssapp3 linkcm2018
        binary
        cd visible/$date                            #进入FTP目录
        lcd /home/gzdssapp/peizhi/cloud_image/visible/$date     #指定本地目录
        put $file_name                              #推送指定文件
        bye
    EOF
      done
    if [ $? -eq 0 ];then
        echo "$date2 /cloud_image/visible/$date push visible successfully!!!" >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
    else
        echo "$date2 /cloud_image/visible/$date push visible failed!!!" >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
    fi
    
    for file in `find /home/gzdssapp/peizhi/cloud_image/weixing/$date -type f -mmin -10`
      do
        file_name=${file##*/}
        ftp -in << EOF
        open 10.12.13.30
        user gzdssapp3 linkcm2018
        binary
        cd weixing/$date
        lcd /home/gzdssapp/peizhi/cloud_image/weixing/$date
        put $file_name
        bye
    EOF
      done
    if [ $? -eq 0 ];then
        echo "$date2 /cloud_image/weixing/$date push weixing successfully!!!" >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
    else
        echo "$date2 /cloud_image/weixing/$date push weixing failed!!!" >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
    fi
    echo "###########################################################$date2#######################################################################"  >> /home/gzdssapp/peizhi/ftp_push/cloud_image.log
  • 相关阅读:
    C#简单的工厂模式
    Microsoft.XMLHttp的属性和方法的简介及使用
    Google Earth 2007中文修订版
    偷懒秘笈之一键生成 Ajax Control Toolkit 标记 (转)
    C#获取硬盘序列号
    Google和百度、雅虎的站内搜索代码
    Visual Studio 2005 Team Suite 180 天试用版
    几种 Dotnet ORM 库的比较
    Windows Server 2003 SP2 0918 Personal 精简版
    通用水晶报表绑定类[原]
  • 原文地址:https://www.cnblogs.com/QicongLiang/p/10001599.html
Copyright © 2011-2022 走看看