Hello
It seems like very simple task,i use virtualbox on debian linux,here my startup/shutdown script:
# /etc/init.d/vbox
#
### BEGIN INIT INFO
# Provides: vbox
# Required-Start: vboxdrv
# Required-Stop: vboxdrv
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: slapd cups
# Should-Stop: slapd cups
# Short-Description: start virtual machines
### END INIT INFO
VMUSER=root
VMNAME="corp14 corp11 misc mert asa"
case "$1" in
start)
ulimit -n 500000
for jjjj in $VMNAME
do
echo "Starting VirtualBox VM...$jjjj"
sudo -H -b -u $VMUSER /usr/bin/VBoxHeadless --startvm "$jjjj" --vrde off
done
;;
stop)
for jjjj in $VMNAME
do
echo "Saving state of Virtualbox VM...$jjjj"
sudo -H -u $VMUSER /usr/bin/VBoxManage controlvm "$jjjj" acpipowerbutton
done
;;
*)
echo "Usage: /etc/init.d/vbox {start|stop}"
exit 1
;;
esac
exit 0
root@vpc0:~#
You need copy this to /etc/init.d/ ,and create link to /etc/rc3.d
ln -s /etc/init.d//vbox /etc/rc3.d/S99vbox,and
stop :
ln -s /etc/init.d/vbox /etc/rc0.d/K99vbox
Inside the script: VMNAME variable contains name of virtual machine,what you want start/stop.
Thats all
regasd
gree