• 从管理节点向应用节点推送目录和文件


    #!/bin/bash

    apps=("192.168.0.96" "192.168.0.98" "192.168.0.168")

    if [ $# -lt 1 ];then
    echo " [ Error ] The paramters passed to this shell is empty!"
    exit 1
    fi

    if [[ ! -d $1 && ! -f $1 ]];then
    echo " [ Error ] $1 does not exist!"
    exit 1
    fi

    params=$1

    if [ ${params:0:1} != "/" ];then
    echo " [ Error ] $1 must start with /"
    exit 1
    fi

    if [[ -d $params && ${params:0-1:1} != "/" ]];then
    params="$params/"
    fi

    for app in ${apps[@]}
    do
    if [ -d $params ];then
    ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no $app "test -d $params || mkdir -p $params"
    fi
    if [ -f $params ];then
    param_dir=${params%/*}
    ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no $app "test -d $param_dir || mkdir -p $param_dir"
    fi
    echo "rsync $app............"
    rsync -avztog --delete --progress -e "ssh -p2222 -i /usr/local/sunlight/sshkeys/init.pk -o strictHostKeyChecking=no" ${params} ${app}:${params}
    done

  • 相关阅读:
    nginx 域名跳转一例~~~(rewrite、proxy)
    军哥 LNMP 常见问题
    Zabbix安装
    PHP远程连接mysql
    Zend Studio 下载
    军哥LNMP优化
    网络流量监控分析工具 Ntopng 安装
    Linux VPS禁止某个IP访问
    DDoS deflate
    MySQL数据库的优化
  • 原文地址:https://www.cnblogs.com/ralphdc/p/8109853.html
Copyright © 2020-2023  润新知