[英]I have to find time taken to register,run vm by euca commands using shell script
I have to find time taken: 我必须找出时间:
I don't know how to find this interval time as I need to check state of VM. 我不知道如何找到此间隔时间,因为我需要检查VM的状态。
You can try the following one-liner to obtain the time taken by an instance to change it's state from pending to running, 您可以尝试以下一种方法来获取实例将其状态从待处理更改为运行所需的时间,
INS=$( euca-run-instances -k sshlogin -t m1.xlarge emi-F51D3A55 \
| grep INSTA | cut -f 2 ); time while(true); \
do if \[ $( euca-describe-instances $INS | grep INSTANCE \
| cut -f 6 ) = "pending" \]; \
then euca-describe-instances $INS; else break; fi; done
This should be reusable for other two as well. 这对于其他两个也应该是可重用的。
By changing the rc.local file, we can make the VM perform some actions just when it becomes running . 通过更改rc.local文件,我们可以使VM仅在运行时执行一些操作。 You could possibly save the time instant at which it becomes running in a file inside the VM itself.
您可以将其开始运行的时间保存在VM本身的文件中。 By this you won't have to keep polling the state of the VM.
这样,您将不必继续轮询VM的状态。 Once the VM is up, you will have the time instant at which is became running .
虚拟机启动后,您将拥有开始运行的时间 。
Hope this helps you out. 希望这可以帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.