腾讯云 - 提升共享带宽包利用率
2024-09-07
15 00 * * * /opt/bin/bwp/man-bwp.sh Add Address ipv6 eip-0ia22w0d,eip-k34v5yiv >> /tmp/man-bwp.log
15 70 * * * /opt/bin/bwp/man-bwp.sh Remoce Address ipv6 eip-0ia22w0d,eip-k34v5yiv >> /tmp/man-bwp.log
30 17 * * * /opt/bin/bwp/man-bwp.sh Add LoadBalance ipv4 lb-5qpp7j6t,lb-66t3too7 >> /tmp/man-bwp.log
#!/bin/bash
function BandwidthPackage(){
action=$1
resource_type=$2
protocol=$3
resource_ids=$4
OLD_IFS="$IFS" #默认的IFS值为换行符
IFS=","
for resource_id in ${resource_ids}
do
if [[ -z ${resource_id} ]];then
continue
else
echo ${action} ${resource_type} ${protocol} ${resource_id}
if [[ ${action} == "Add" ]];then
/usr/local/bin/tccli vpc ${action}BandwidthPackageResources --cli-unfold-argument --region ${region} --BandwidthPackageId ${bwp_id} --Protocol ${protocol} --ResourceType ${resource_type} ${use_protocol} --ResourceIds ${resource_id}
else
/usr/local/bin/tccli vpc ${action}BandwidthPackageResources --cli-unfold-argument --region ${region} --BandwidthPackageId ${bwp_id} --ResourceType ${resource_type} ${use_protocol} --ResourceIds ${resource_id}
fi
fi
done
IFS="$OLD_IFS"
sleep 1
}
bwp_id="bwp-4zyc9rib"
region="ap-shanghai"
action=$1
resource_type=$2
protocol=$3
resource_ids=$4
if [[ -z ${action} ]];then
echo no action,please choice Add OR Remove!
exit 1
fi
BandwidthPackage ${action} ${resource_type} ${protocol} ${resource_ids}