当前位置 博文首页 > Shell脚本实现上传zip压缩文件到FTP服务器

    Shell脚本实现上传zip压缩文件到FTP服务器

    作者:admin 时间:2021-06-23 18:30

    复制代码 代码如下:

    # /bin/bash
    # creator:lihuibin
    # date : 2014-03-10 16:45
    # desc : upload file to ftp
    hosts="192.168.56.100"
    port=21
    user=test
    pass=testpwd
    work_path="/var/www/cms"
    packname="publish"
    #hosts=$1
    #port=$2
    #user=$3
    #pass=$4
    #packname=$6
    #work_path=$5
    cd $work_path
    /usr/bin/zip -r $packname *
    [ -f "$work_path/$packname" ] &&{
    ftp -n<<!
    open $hosts $port
    type binary
    user $user $pass
    cd /upload
    lcd $work_path
    prompt
    put $packname
    close
    bye
    !
    rm -f $packname
    }

    js
    下一篇:没有了