Created
January 14, 2014 11:11
-
-
Save hard-geha/8416723 to your computer and use it in GitHub Desktop.
Simple init.d script to save all running virtualboxes on host shutdown or reboot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: save-running-virtualboxes | |
# Required-Start: | |
# Required-Stop: $network | |
# Default-Start: | |
# Default-Stop: 0 1 6 | |
# Short-Description: Stops all running virtualboxes | |
# Description: Stops all running virtualboxes of all users | |
### END INIT INFO | |
case "$1" in | |
stop) | |
echo "Saving all running virtualboxes ..." | |
for user in $(ps -ouser= -C VBoxHeadless,VirtualBox | sort -u); do | |
for vm_name in $(su -c '/usr/bin/VBoxManage list runningvms | cut -d " " -f 1' $user); do | |
echo "Saving box '$vm_name' of user '$user'" | |
su -c "/usr/bin/VBoxManage controlvm $vm_name savestate" $user | |
done | |
done | |
echo "Done." | |
;; | |
*) | |
echo "Usage: /etc/init.d/save-running-virtualboxes stop" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Have to same issue und same idea but doesnt work for me. When i will reboot my System it idles still on 'waiting for vboxnet0 to become free'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
INSTALL
WHY