#!/bin/bash
# Author : royoy
# Ver : v2
# Date : 10/2019
salt_bin=/bin/salt
front_nodeG_name=${2:-front_web}
cdn_opt="${1:-check_cdn}"
cdn_conf=/data/shell/cdn_config/cdn_domainName.property
domainName=${1:-`awk -F= '/^domainName.*=/{print $2;exit}' $cdn_conf`}
check_result="`$salt_bin -N "$front_nodeG_name" cmd.script salt://scripts/check_cdn_stat.sh "check_cdn $domainName"`" #多个变量参数,需要放到一个引号内
if `echo ${check_result} |grep -q "关闭"`;then
font -d "域名为: [" -cyan "$domainName" -reset "] 的生产CDN-当前状态: " -yellow "关闭" -reset -n
elif `echo ${check_result} |grep -q "开启"`;then
font -d "域名为: [" -cyan "$domainName" -reset "] 的生产CDN-当前状态: " -green "开启" -reset -n
else
font -f 10 \= -red "异常错误如下: " -r -f 10 \= -n
font "$check_result" -n
exit 23
fi