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;

 

转载于:https://www.cnblogs.com/husbandmen/p/7054963.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值