zoukankan      html  css  js  c++  java
  • cloud foundry 中 url map/unmap

    cloud foundry 中遇到url较多的应用进程,真是令人头疼的一件事,只能抽时间写个自动map和unmap的小脚本。

    #!/bin/bash
    # ********* USEAGE *************
    
    # Time:2017/5/17
    # version:V 1.0.0
    # auth: songfucai
    # content:user to map or unmap app's url
    # note:
    #     1.only suitable for china zuul
    # *****************************
    
    ####map-route function
    function mapRoute()
    {
    echo -n "Please type in the name of the application need to map-route....."
    read mapapp
    if [[ $mapapp == "exit" ]];then
        exit 1
    fi
    if read -t 30 -p "Whether to confirm to map-route ${mapapp} ?[y|n]:" yn
    then
        if [[ $yn == [Yy] ]];then
             cf  map-route  $mapapp     domain  -n  host
             cf a|grep appname
        elif [[ $yn == [Nn] ]];then
                exit 0
        elif [[ $yn == "exit" ]];then
            exit 1
        else [[ $yn != [YyNn] ]]
            unmapRoute;
     
        fi
    else
        echo " "
        echo -e "e[0;33;1mTimeOut ...e[0m"
        exit 1
    fi 
    }
    
    ####unmap-route function
    function unmapRoute()
    {
    echo -n "Please type in the name of the application need to unmap-route....."
    read unmapapp
    if [[ $unmapapp == "exit" ]];then
        exit 1
    fi
    if read -t 30 -p "Whether to confirm to unmap-route ${unmapapp} ?[y|n]:" yn
    then
        if [[ $yn == [Yy] ]];then
            cf  unmap-route  $unmapapp   domain  -n  host
            cf a|grep appname
    
        elif [[ $yn == [Nn] ]];then
            exit 0
        elif [[ $yn == "exit" ]];then
            exit 1
        else [[ $yn != [YyNn] ]]
            mapRoute;
        fi
    else
        echo " "
        echo -e "e[0;33;1mTimeOut ...e[0m"
        exit 1
    fi     
    }
    
    echo "only suitable for china zone appname....."
    mapRoute;
    unmapRoute;
  • 相关阅读:
    停下来,等等灵魂(二)
    停下来,等等灵魂(一)
    swoole流程图
    使用 Spring Cloud Sleuth、Elastic Stack 和 Zipkin 做微服务监控
    Portainer实战
    Docker 容器日志分析
    docker容器日志查看
    java(集合框架)(转)
    js中const,var,let区别与用法(转)
    【MySQL】Mac通过brew安装的MySQL重启方法
  • 原文地址:https://www.cnblogs.com/husbandmen/p/7054963.html
Copyright © 2011-2022 走看看