Automatic matching and binding auto scaling policy "shell" based on memory size

Source: Internet
Author: User

#!/bin/Bash forXinch$ (cf a|grepstarted|TR-S" "|Cut-D" "-F1) Doins_quantity=$ (cf a|grep$x |TR-S" "|Cut-D" "-F3|Cut-D"/"-F2); App_memory=$ (cf a|grep$x |TR-S" "|Cut-D" "-F4); Echo "AppName:"$xEcho "Instance num:"${ins_quantity}; Unit_suffix=`Echo${app_memory:-1}`; if[[$unit _suffix = ="G"]]; ThenApp_memory_num=`Echo${app_memory%g*}`; elif[[$unit _suffix = ="M"]]; ThenApp_memory_num=`Echo${app_memory%m*}`; Else       Echo "Erros:unit_suffix Get fail!"Exit1; fi  Echo "app_memory Num:"${app_memory_num}; Echo "Unit_suffix:"${unit_suffix}; strategy_name=""  Case$app _memory_numinch         +) Strategy_name="m0.5c25"        ;; 1) Strategy_name="M1C50"        ;; 1.5) Strategy_name="m1.5c75"        ;; 2) Strategy_name="m2c100"        ;; 2.5) Strategy_name="m2.5c125"        ;; 3) Strategy_name="m3c150"            ;; 3.5) Strategy_name="m3.5c175"        ;; 4) Strategy_name="m4c200"        ;; Esac      Echo "Strategy_name:"$strategy _nameif[[$ins _quantity-ge2&& $strategy _name! =""]]; Then        Echo "ASPT bind-a"$x"- P"$strategy _name"- e true"; ASPT Bind-A $x-p $strategy _name-etrue; Else        Echo "Appanme:"$x"Is isn't set auto scale! Because ins num too small!"          fi;  Done

Automatically match and bind auto scaling policy "shell" based on memory size

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.