Page 1 of 1

start vm on boot in lion

Posted: 19. Nov 2011, 01:09
by nateswitch
I'm running a VM on a Lion server machine.

I added a launchd plist as follows:

Code: Select all

<?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>com.test.ResourceSpaceVirtualbox</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/VBoxHeadless</string>
    <string>-s</string>
    <string>ResourceSpace</string>
  </array>
  <key>UserName</key>
  <string>admin</string>
  <key>WorkingDirectory</key>
  <string>/Users/admin</string>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
Ran:

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
The VM started just fine.

I then rebooted the server to test to make sure it would come up after a reboot, and it didn't

When running

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
it stated "com.test.ResourceSpaceVirtualbox: Already loaded"

Checking activity monitor I didn't see VBoxHeadless, VBoxSVC or VBoxXPCOMIPCD

I ran

Code: Select all

sudo launchctl unload -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
followed by

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.test.ResourceSpaceVirtualbox.plist
and it started fine, I saw the three processes mentioned earlier.

Does anyone have any suggestions on how to get this to work properly on a reboot? Where am I falling down with this script?

Thanks!

Re: start vm on boot in lion

Posted: 7. Dec 2011, 23:20
by jbrooks
Nateswitch, did you get this resolved? I need to do something similar and want to follow your lead.