Headless VirtualBox
Updated (2010-12-02)
So, duh, multiple interfaces. One NAT one Host-Only. All done.
The biggest hangup is networking. I had to switch it to Host-Only so that the interface would remain consistent. Other wise with bridged I would get new IP's all the time, and even then only when the networking init script got triggered somehow.
After that was set I just wrote two quick bash scripts to start and stop. An init script would also be an option if I wanted to make sure it shut down when I power off the laptop, but I decided it wasn't worth the trouble.
The key commands are VBoxHeadless -startvm [vm name] and VBoxManage controlvm [vm name] savestate
blanksmtp-start
#!/bin/bash
COUNT=$( ps aux | grep 'VBoxHeadless -startvm BlankSMTP' | grep -v grep | wc -l)
if [ "$COUNT" == "0" ]; then
echo "Starting BlankSMTP..."
nohup VBoxHeadless -startvm BlankSMTP > /dev/null 2>&- &
else
echo "Found a running instance!"
fi
blanksmtp-stop
#!/bin/bash
COUNT=$( ps aux | grep 'VBoxHeadless -startvm BlankSMTP' | grep -v grep | wc -l)
if [ "$COUNT" == "0" ]; then
echo "No running instance!"
else
echo "Shutting down..."
VBoxManage controlvm BlankSMTP savestate
fi
Works like a charm!