分发执行检查cdn状态脚本

分发执行检查cdn状态脚本

#!/bin/bash
# Author: royoy
# Ver   : v2
# Date  : 07/2019
# LMod  : 10/2019
# Desc  : Check cdn status for xtyy

conf_php="/data/bm/config/var.php"
cdn_opt="$1"
reg="${2:-`sed -n 's/^domainName=\(.*\)/\1/p' $conf_domainName`}"

manage_cdn(){
        [ "x$1" = "xcheck_cdn" ] && {
                if `grep "$reg" $conf_php | grep -E "^\s*'" |grep -q '1'`;then font -d "CDN-当前状态: " -green "开启" -reset -n;else font -d "CDN-当前状态: " -yellow "关闭" -reset -n;fi
        } || {
                font -d  "Option error!!" -n
        }
}

[[ "xcheck_cdn" = "x$cdn_opt" ]] && manage_cdn "$cdn_opt"