Upstart and Virtualbox

Upstart script for starting and stopping Virtualbox machines. This goes into /etc/init/vbox-agila-ledare.conf (which could be paremetrized, look this up in the upstart cookbook).

#
# Upstart receipt for starting Virtualbox machines after reboot
#
description "VM for agila-ledare.se"
author "Fredrik Wendt"
 
start on start-vbox-machines
stop on runlevel [016]
 
console output
 
pre-stop script
  su vbox -c "VBoxManage controlvm agila-ledare savestate"
end script
 
script
  exec su vbox -c "VBoxHeadless --startvm agila-ledare"
end script

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>