-
-
Save bistoco/4cb254360d42f9a51c3a to your computer and use it in GitHub Desktop.
Revisions
-
bistoco revised this gist
Feb 6, 2016 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -123,6 +123,14 @@ Finally, test the configuration by running: After a reboot, the VMs that have been set with autostart enabled should be running! To check for vms running, without starting a GUI session, connect through ssh as the user that run the vms, and type ps aux | grep vmname And you will get something like username 1201 15.4 2.7 2783284 228952 ?? S 3:28PM 0:07.01 /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless --comment vmname --startvm XXXXXXX-YYYY-YYYY-YYYY-XXXXXX --vrde config ### References <https://www.virtualbox.org/manual/ch09.html#autostart-osx> -
bistoco revised this gist
Feb 6, 2016 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -73,6 +73,49 @@ Now, configure the VMs that should automatically start and set how they should b VBoxManage modifyvm vmname --autostart-enabled on VBoxManage modifyvm vmname --autostop-type acpishutdown From [jgentsch's](https://gist.github.com/jgentsch) comment [here](https://gist.github.com/reidransom/6042016#gistcomment-1413984) add a funtion to `/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh` in order to wait until kernel modules are loaded. ... start of skript ommitted ... function waitForKernelModules() { VBOX_EXT=0 CHECK_CNT=0 until [[ $VBOX_EXT -eq 1 || $CHECK_CNT -gt 60 ]]; do echo Check for VBox-Kernelmodules - ${CHECK_CNT} sleep 1 VBOX_EXT=1 CHECK_CNT=$(( ${CHECK_CNT} + 1 )) if kextstat -lb org.virtualbox.kext.VBoxDrv 2>&1 | grep -q org.virtualbox.kext.VBoxDrv; then echo "Found org.virtualbox.kext.VBoxDrv. Good." else VBOX_EXT=0 fi if kextstat -lb org.virtualbox.kext.VBoxUSB 2>&1 | grep -q org.virtualbox.kext.VBoxUSB; then echo "Found org.virtualbox.kext.VBoxUSB. Good." else VBOX_EXT=0 fi if kextstat -lb org.virtualbox.kext.VBoxNetFlt 2>&1 | grep -q org.virtualbox.kext.VBoxNetFlt; then echo "Found org.virtualbox.kext.VBoxNetFLT. Good." else VBOX_EXT=0 fi if kextstat -lb org.virtualbox.kext.VBoxNetAdp 2>&1 | grep -q org.virtualbox.kext.VBoxNetAdp; then echo "Found org.virtualbox.kext.VBoxAdp. Good." else VBOX_EXT=0 fi done } CONFIG=${1} waitForKernelModules vboxStartStopAllUserVms "start" trap vboxStopAllUserVms HUP KILL TERM Finally, test the configuration by running: -
bistoco revised this gist
Feb 6, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Copy the Virtualbox autostart plist template file to your system's LaunchDaemons /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \ /Library/LaunchDaemons Then edit `/Library/LaunchDaemons/org.virtualbox.vboxautostart.plist` set `Disabled` to `false`, and confirm the last string entry in the command array is set to `/etc/vbox/autostart.cfg`. The file should look like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -
bistoco revised this gist
Feb 6, 2016 . 1 changed file with 35 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,24 +16,46 @@ Then edit `/Library/LaunchDaemons/org.virtualbox.vboxautostart.plist` set `Disab <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <false/> <key>Label</key> <string>org.virtualbox.vboxautostart</string> <key>ProgramArguments</key> <array> <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string> <string>/etc/vbox/autostart.cfg</string> </array> <key>RunAtLoad</key> <true/> <key>LaunchOnlyOnce</key> <true/> </dict> </plist> Then edit `/Library/LaunchDaemons/org.virtualbox.startup.plist` set `Disabled` to `false`, set `KeepAlive` to `true`. The file should look like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.virtualbox.startup</string> <key>Disabled</key> <false/> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>LaunchOnlyOnce</key> <true/> <key>ProgramArguments</key> <array> <string>/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh</string> <string>restart</string> </array> </dict> </plist> Make the directory `/etc/vbox` and create the file `/etc/vbox/autostart.cfg` with the following content: default_policy = allow osxusername = { allow = true } -
reidransom created this gist
Jul 19, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ # Auto-starting VirtualBox VMs on OS X After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation. [Link to original article.](http://rcaguilar.wordpress.com/2013/01/07/auto-starting-virtualbox-vms-on-os-x/) Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder. sudo cp \ /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \ /Library/LaunchDaemons Then edit `/Library/LaunchDaemons/org.virtualbox.vboxautostart.plist` set `Disabled` to `false`, set `KeepAlive` to `true`, and confirm the last string entry in the command array is set to `/etc/vbox/autostart.cfg`. The file should look like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <false/> <key>KeepAlive</key> <true/> <key>Label</key> <string>org.virtualbox.vboxautostart</string> <key>ProgramArguments</key> <array> <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string> <string>--start</string> <string>/etc/vbox/autostart.cfg</string> </array> </dict> </plist> Make the directory `/etc/vbox` and create the file `/etc/vbox/autostart.cfg` with the following content: default_policy = deny osxusername = { allow = true } Make sure to change osxusername to the username on your system that the VMs are under. Next properly set permissions: sudo chmod +x /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh sudo chown root:wheel /etc/vbox sudo chown root:wheel /etc/vbox/autostart.cfg sudo chown root:wheel /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist Now, configure the VMs that should automatically start and set how they should be stopped: VBoxManage modifyvm vmname --autostart-enabled on VBoxManage modifyvm vmname --autostop-type acpishutdown Finally, test the configuration by running: sudo launchctl load /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist After a reboot, the VMs that have been set with autostart enabled should be running! ### References <https://www.virtualbox.org/manual/ch09.html#autostart-osx> <https://forums.virtualbox.org/viewtopic.php?f=8&t=51593&start=15#p240724> <https://forums.virtualbox.org/viewtopic.php?f=11&t=51529#p236492>