ITPub博客

首页 > Linux操作系统 > Linux操作系统 > vbox control script - vmcontrol.sh

vbox control script - vmcontrol.sh

原创 Linux操作系统 作者:mrzcs 时间:2014-03-17 14:49:06 0 删除 编辑
最近实验用vbox较多,为了方便管理众多vms,写了个vms管理脚本vmcontrol.sh。
以headless方式启动,避免了图形界面,也不怕logout造成vms关闭。
环境:
SuSE 11.1 x86_64
VBox: 4.2.16r86992
最新的v1.4支持linux和windows,当然需要安装cygwin。功能上包括启动,关闭,查看vm,创建,删除,回滚,查看以及重命名snapshot.

Usage: vmcontrol.sh {startvm|stopvm|listvm|takess|deletess|listss|resotress|renamess}

Examples:
a. show usage
D:\vm>bash vmcontrol.sh
Usage: vmcontrol.sh {startvm|stopvm|listvm|takess|deletess|listss|resotress|renamess}

b. start vms
D:\vm>bash vmcontrol.sh startvm
1) ocm11g_even:stop        4) sol10_oracle10201:stop
2) ocm11g_odd:stop         5) sol10_oracle10202:stop
3) oel54_112_32bit:stop    6) sol10_oracle11201:stop
Please select vm: 3
your select is: oel54_112_32bit
Waiting for VM "oel54_112_32bit" to power on...
VM "oel54_112_32bit" has been successfully started.

c. list vms
D:\vm>bash vmcontrol.sh listvm
ocm11g_even:stop
ocm11g_odd:stop
oel54_112_32bit:running
sol10_oracle10201:stop
sol10_oracle10202:stop
sol10_oracle11201:stop

d. stop vms
D:\vm>bash vmcontrol.sh stopvm
1) ocm11g_even:stop         4) sol10_oracle10201:stop
2) ocm11g_odd:stop          5) sol10_oracle10202:stop
3) oel54_112_32bit:running  6) sol10_oracle11201:stop
Please select vm: 3
your select is: oel54_112_32bit
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%

e. list snapshot
D:\vm>bash vmcontrol.sh listss
1) ocm11g_even:stop        4) sol10_oracle10201:stop
2) ocm11g_odd:stop         5) sol10_oracle10202:stop
3) oel54_112_32bit:stop    6) sol10_oracle11201:stop
Please select vm: 1
your select is: ocm11g_even
   00_soft_ready
      01_gc_soft_ready
         02_gc_agent_ready

f. restore snapshot
D:\vm>bash vmcontrol.sh restoress
1) ocm11g_even:stop        4) sol10_oracle10201:stop
2) ocm11g_odd:stop         5) sol10_oracle10202:stop
3) oel54_112_32bit:stop    6) sol10_oracle11201:stop
Please select vm: 1
your select is: ocm11g_even
1)    Name: 00_soft_ready             3)          Name: 02_gc_agent_ready
2)       Name: 01_gc_soft_ready
Please select snapshot name to restore:

下载地址
https://github.com/mrzcs/bash_script/blob/master/vmcontrol.sh

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7314577/viewspace-1123245/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2012-07-10

  • 博文量
    3
  • 访问量
    11633