zoukankan      html  css  js  c++  java
  • 根据项目找到主机清除日志脚本


    #!/bin/bash
    DATA=/data/prog/project
    IP1=172.16.1.41
    IP2=172.16.1.42
    IP3=172.16.1.43
    IP4=172.16.1.44
    IP5=172.16.1.45
    IP6=172.16.1.46
    IP7=172.16.1.49
    IP8=172.16.1.50
    IP9=172.16.1.51
    IP10=172.16.1.52

    if [ $1 == 'oauth-server' ] || [ $1 == 'wxauth' ]; then
    chdir=$DATA/$1/logs
    ansible $IP1 -m shell -a " > $DATA/$1/logs/$1-console.log"
    ansible $IP2 -m shell -a " > $DATA/$1/logs/$1-console.log"
    if [ $? == 0 ]; then
    echo "-----$1日志清除成功-----"
    else
    echo "-----请检查项目名字-----"
    fi

    elif [ $1 == 'activity_server' ] || [ $1 == 'app_agency' ] || [ $1 == 'base_push_server' ] || [ $1 == 'channel_server' ] || [ $1 == 'community_server' ] || [ $1 == 'education_server' ] || [ $1 == 'manage_agency' ] || [ $1 == 'member_server' ] || [ $1 == 'server_advert' ] || [ $1 == 'shop_server' ] || [ $1 == 'vod_server' ] || [ $1 == 'wlan_server' ] || [ $1 == 'ai_server' ] || [ $1 == 'app-live' ] || [ $1 == 'base_server' ] || [ $1 == 'city_business_card' ] || [ $1 == 'credit_server' ] || [ $1 == 'im_server' ] || [ $1 == 'manage-live' ] || [ $1 == 'pay_server' ] || [ $1 == 'server_zhixiangtuike' ] || [ $1 == 'tour_distributor' ] || [ $1 == 'web-data-center' ] || [ $1 == 'xxl_job' ]; then
    chdir=$DATA/$1/logs
    ansible $IP3 -m shell -a " > $DATA/$1/logs/$1-console.log"
    ansible $IP4 -m shell -a " > $DATA/$1/logs/$1-console.log"
    if [ $? == 0 ]; then
    echo "-----$1日志清除成功-----"
    else
    echo "-----请检查项目名字-----"
    fi
    elif [ $1 == 'app_enterScene_after' ] || [ $1 == 'app_enter_scenic' ] || [ $1 == 'app_tourism' ] || [ $1 == 'mini_apps_tourism' ] || [ $1 == 'nkb_manage' ] || [ $1 == 'nk_manage' ] || [ $1 == 'push_server' ] || [ $1 == 'scene_manage' ] || [ $1 == 'user_center' ]; then
    chdir=$DATA/$1/logs
    ansible $IP5 -m shell -a " > $DATA/$1/logs/$1-console.log"
    ansible $IP6 -m shell -a " > $DATA/$1/logs/$1-console.log"
    if [ $? == 0 ]; then
    echo "-----$1日志清除成功-----"
    else
    echo "-----请检查项目名字-----"
    fi
    elif [ $1 == 'app-distributor' ] || [ $1 == 'app-member' ] || [ $1 == 'app-shop' ] || [ $1 == 'community_im' ] || [ $1 == 'digital_config' ] || [ $1 == 'finance-service' ] || [ $1 == 'shop' ] || [ $1 == 'web-coupon' ] || [ $1 == 'web-distributor' ] || [ $1 == 'web-member' ] || [ $1 == 'web-shop' ]; then
    chdir=$DATA/$1/logs
    ansible $IP7 -m shell -a " > $DATA/$1/logs/$1-console.log"
    ansible $IP8 -m shell -a " > $DATA/$1/logs/$1-console.log"
    if [ $? == 0 ]; then
    echo "-----$1日志清除成功-----"
    else
    echo "-----请检查项目名字-----"
    fi

    elif [$1 == 'app_butler' ] || [ $1 == 'app_community' ] || [ $1 == 'city_card' ] || [ $1 == 'sms_butler' ] || [ $1 == 'sms_community' ] || [ $1 == 'web_butler' ] || [ $1 == 'web_community' ] || [ $1 == 'web_sms' ]; then
    chdir=$DATA/$1/logs
    ansible $IP9 -m shell -a " > $DATA/$1/logs/$1-console.log"
    ansible $IP10 -m shell -a " > $DATA/$1/logs/$1-console.log"
    if [ $? == 0 ]; then
    echo "-----$1日志清除成功-----"
    else
    echo "-----请检查项目名字-----"
    fi
    fi

  • 相关阅读:
    设计模式——观察者模式
    安卓xml动画
    部署在weblogic上的springboot项目上传文件(servlet方式)
    Spring Boot 部署到weblogic 12c
    SpingBoot+Druid监控页面打不开(404)
    DAY49-前端入门-浮动布局案例、z-index、flex布局、响应式布局、过渡与动画
    DAY48-前端入门-文档流、浮动布局、清浮动、流式布局、定位布局
    DAY46-前端入门-组合选择器、标签a_img_list、盒模型、伪类、盒模型布局
    DAY45-前端入门-css的三种引用方式以及优先级、样式与长度颜色、常用样式、css选择器
    DAY44-前端入门-前端三剑客、第一个页面、常用标签、标签分类
  • 原文地址:https://www.cnblogs.com/zgqbky/p/15321322.html
Copyright © 2011-2022 走看看