VirtualBox

Ticket #10868: vboxtool.stop

File vboxtool.stop, 925 bytes (added by travism, 12 years ago)

VBox Shutdown script

Line 
1#!/bin/bash
2################################################################################
3# Author: Travis McDermott #
4# Date of Creation: 8/28/2012 #
5# Last Revision: 8/28/2012 #
6# Synopsis: Safely saves machine state of virtualbox VMs. Depends on vboxtool. #
7# Originally concieved to address a bug which caused system halt to loop #
8# loop endlessly while waiting for host interface to be freed, even after #
9# machines were successfully stopped. #
10################################################################################
11vmuser="vboxuser"
12vboxtool="/usr/local/bin/vboxtool"
13
14halt_wait() {
15runningVMs=$($vboxtool showrun | wc -l )
16if [ $runningVMs != 0 ]; then
17 sleep 5
18 echo "saving state of $runningVMs VMs..."
19 halt_wait
20else
21return 0
22fi
23}
24su - $vmuser -c "$vboxtool save"
25halt_wait
26modprobe -l vboxnetadp
27modprobe -l vboxnetflt
28modprobe -l vboxdrv

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy