怎么用VirtualBox后台运行?~

VirtualBox 这个虚拟机我第一次使用!~

对他不是很熟悉,配置完成后发现不能后台运行 每次启动都会有界面,对于想要模拟集群的我来说很麻烦~!

我经过查阅资料发现 可以只用 VBoxManage来启动!~

查看help


VBoxManage startvm          <uuid>|<name>
                            [--type gui|sdl|headless]

 

可见他有三个启动模式 分别是  gui  界面

 

 sdl 是什么?,启动就报错

资料说  headless启动没有界面

 

于是 试着运行headless模式,果然没有界面,只不过有个黑色的框框,恶心呀!~

以前有过VBS后台运行程序的经验

 

DIM objShell
set objShell=wscript.createObject("wscript.shell")
iReturn=objShell.Run("pldev.bat /start", 0, TRUE)

 

这样就 可以后台运行

 

那么我试着这样执行

DIM objShell
set objShell=wscript.createObject("wscript.shell")
iReturn=objShell.Run("VBoxManage startvm hadoop -type headless", 0, TRUE)

 

结果呢还是有个黑框框,为什么不能隐藏呢?

我多次实验发现原来VBoxManage 在使用headless模式启动的时候实际上是弹出了另一个程序,是弹出!~

所以我的VBS隐藏了VBoxManage 没有隐藏他的弹出程序!~

我试着直接调用他的弹出程序VBoxHeadless.exe,然后我运行help

C:/Users/IXR>VBoxHeadless
Oracle VM VirtualBox Headless Interface 4.0.8
(C) 2008-2011 Oracle Corporation
All rights reserved.

Usage:
   -s, -startvm, --startvm <name|uuid>   Start given VM (required argument)
   -v, -vrde, --vrde on|off|config       Enable (default) or disable the VRDE
                                         server or don't change the setting
   -e, -vrdeproperty, --vrdeproperty <name=[value]> Set a VRDE property:
                                         "TCP/Ports" - comma-separated list of p
orts
                                         the VRDE server can bind to. Use a dash
 between
                                         two port numbers to specify a range
                                         "TCP/Address" - interface IP the VRDE s
erver
                                         will bind to
   -c, -capture, --capture               Record the VM screen output to a file
   -w, --width                           Frame width when recording
   -h, --height                          Frame height when recording
   -r, --bitrate                         Recording bit rate when recording
   -f, --filename                        File name when recording.  The codec
                                         used will be chosen based on the
                                         file extension

 

没错 他和 VBoxManage 一样有 startvm 这样可以理解了!~哈哈

于是我修改VBS

DIM objShell  
set objShell=wscript.createObject("wscript.shell")  
iReturn=objShell.Run("VBoxHeadless -startvm hadoop", 0, TRUE)

 

保存,运行start.vbs 哇!~ 没有任何反映 看进程 有了 VBoxHeadless

 

ping 虚拟机

C:/Users/IXR>ping 10.0.0.100

正在 Ping 10.0.0.100 具有 32 字节的数据:
来自 10.0.0.100 的回复: 字节=32 时间<1ms TTL=64
来自 10.0.0.100 的回复: 字节=32 时间<1ms TTL=64
来自 10.0.0.100 的回复: 字节=32 时间<1ms TTL=64

 

启动了,呵呵 ssh连接上吧!~

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值