Cloudify REST指令碼

來源:互聯網
上載者:User

Cloudify REST指令碼 01#!/bin/bash02  03bootOutput="bl.out"04rm -f $bootOutput//刪除b1.out檔案05./cloudify.sh "bootstrap-cloud ec2" > $bootOutput 2>&1//運行./cloudify.sh bootstrap-cloud ec2並將輸出到b1.out和標準輸入重新導向到標準輸出。06searchString="Rest service is"07selectedText=`grep "${searchString}" $bootOutput`//尋找b1.out中"Rest service is"的行賦給selectedText08rawValue=`echo ${selectedText} | awk '{print $6}'`//將selectedText中第六個域(以空格或tab分割)賦給rawValue09restURL="${rawValue%?}"//linux字串操作,刪除rawValue的最後一個字元後執行,即提取restURL10echo "1st restURL is ${restURL}" >> $bootOutput 2>&1//列印並重新導向到b1.out和標準輸出11  12# If there are two management machines (and in production, we recommend it...),13# you'll have two Rest URLs14rawValue=`echo ${selectedText} | awk '{print $12}'`//和上面一樣15rest2URL="${rawValue%?}"16echo "2nd restURL is ${rest2URL}" >> $bootOutput 2>&117  18# Now set the restURL value in the service context attributes (global scope ,19# so it'll be available for all applications) :20# e.g. : set-attributes -scope global '{"restURL":"${restURL}", "rest2URL":"${rest2URL}"}'21./cloudify.sh "connect ${restURL};set-attributes -scope global '{\"restURL\":\"${restURL}\", \"rest2URL\":\"${rest2URL}\"}'" >> $bootOutput 2>&1//串連restURL並將restURL設為所有應用的全域屬性22  23# Just checking that it's there :)24./cloudify.sh "connect ${restURL};list-attributes" >> $bootOutput 2>&1//測試連接並顯示所有屬性25  26# Now you can install any application27# and access the restURL attribute (or "rest2URL")28# e.g.: In a groovy lifecycle event handler :29#  def restURL = context.attributes.global["restURL"]30# ./cloudify.sh "connect ${restURL};install-application PATH_TO_APPLICATION" >> $bootOutput 2>&1
 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.