Skip to content

Instantly share code, notes, and snippets.

@noxqsgit
Created October 22, 2012 14:48
Show Gist options
  • Save noxqsgit/3931842 to your computer and use it in GitHub Desktop.
Save noxqsgit/3931842 to your computer and use it in GitHub Desktop.
vbox launchd
<?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>Label</key>
<string>nl.noxqslabs.vbox</string>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>noxqs</string>
<key>WorkingDirectory</key>
<string>/Users/noxqs</string>
<key>ProgramArguments</key>
<array>
<string>/Users/noxqs/vbox/vbox.sh</string>
</array>
</dict>
</plist>
#!/bin/bash
vm=ubus1
function stop_vm () {
VBoxManage controlvm "$vm" savestate
exit 0
}
trap stop_vm SIGTERM
VBoxHeadless --startvm "$vm" &
wait $!
# --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment