rc.d script to start Virtual Box guest.

Hi all,

I made a rc.d script to start and stop my virtual box guest.


Code:
#!/bin/sh
# REQUIRE: login
# PROVIDE: vmsd
# KEYWORD: shutdown

. /etc/rc.subr


name="vmsd"
rcvar=`set_rcvar`
start_cmd="${name}_start"
stop_cmd="${name}_stop"

load_rc_config $name

vmsd_start()
{

	echo "Starting VMS machines"
	su vms -c '/usr/local/bin/VBoxHeadless -startvm fcserver'&

	
	return 1
}

vmsd_stop()
{
	echo "Saving states for all VMS machines.."
	su vms -c '/usr/local/bin/VBoxManage controlvm fcserver savestate' 
	return 1

}

#${vmsd_enable="NO"}

run_rc_command "$1"

I have specified
Code:
vmsd_enable="YES"
in my rc.conf.

For some reason, doing ./vmsd stop and ./vmsd start works perfect.

But when the machine boots it doesnt want to load the script or echo any of the messages...

Also the scripts are set with the correct permissions
 
Back
Top