VirtualBox Linux服务vbox-service-template

本文介绍了如何使用VBox-Service-Template将VirtualBox虚拟机设置为服务运行,包括安装步骤、配置自动启动、处理VM关闭情况以及VM网络可达性的检查方法。

vbox-service-template is an init.d script template for running a VirtualBox machine as a service.

Sending a stop command to the service will either save the state of the VM (hibernate) or send the ACPI Power Button signal to the VM and wait for it to self-terminate (powerbutton).

Some more context and howto information can be found here: http://www.glump.net/howto/

virtualbox_as_a_service下载

Installation
Make a copy of the script as /etc/init.d/vbox-NAME and follow the instructions in the comments in the script. Make sure you set the x bit on the file to make it executable.

To mark the service for automatic start at boot time:

Ubuntu: update-rc.d vbox-NAME defaults 90 (The '90' is to make sure it starts after the VirtualBox core services.
Fedora: chkconfig vbox-NAME on
To remove the service from the boot process:

Ubuntu: update-rc.d -f vbox-NAME remove
Fedora: chkconfig vbox-NAME off
Additionally, if you are going to shut down your computer while a VM is running you should tell VirtualBox how to handle shutdown. Create or edit /etc/default/virtualbox:

SHUTDOWN_USERS="user1 user2" # space-delimited list of users who might have runnings vms
SHUTDOWN=savestate # if any are found, suspend them to disk
Usage
Start
service vbox-NAME start

Start and wait for the VM to be reachable on the network
service vbox-NAME start-wait

Stop (hibernate or power button -- see config lines in script)
service vbox-NAME stop

Restart
service vbox-NAME restart

Restart and wait for the VM to be reachable on the network
service vbox-NAME restart-wait

Display status
service vbox-NAME status

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值