Hello,
I have successfully made an rc.d startup script for a VirtualBox virtual machine; however, when I reboot my host machine with [cmd=]shutdown -r now[/cmd] the virtual machine gets shutdown hard. Here is my /usr/local/etc/rc.d/freebsdvbox1 command:
What am I doing wrong? When the host machine gets shutdown, I want [cmd=]shutdown -p now[/cmd] to be sent to the virtual machine, and then continue shutting down the host machine. Also, if I manually run:
[cmd=]/usr/local/etc/rc.d/freebsdvbox1 stop[/cmd]
The virtual machine shuts down gracefully.
I have successfully made an rc.d startup script for a VirtualBox virtual machine; however, when I reboot my host machine with [cmd=]shutdown -r now[/cmd] the virtual machine gets shutdown hard. Here is my /usr/local/etc/rc.d/freebsdvbox1 command:
Code:
#!/bin/sh
# Add the following line to /etc/rc.conf to enable freebsdvbox1:
#
# PROVIDE: freebsdvbox1
# REQUIRE: LOGIN vboxnet
#
# freebsdvbox1_enable="YES"
. /etc/rc.subr
name=freebsdvbox1
rcvar=`set_rcvar`
command="/usr/local/bin/VBoxHeadless"
command_args=" --vnc --vncport 5901 --startvm freebsdvbox1 2>/var/log/freebsdvbox1.error.log 1>/var/log/freebsdvbox1.log &"
load_rc_config freebsdvbox1
stop_cmd="ssh david@freebsdvbox1 'sudo shutdown -p now'; sleep 5; date;"
run_rc_command "$1"
What am I doing wrong? When the host machine gets shutdown, I want [cmd=]shutdown -p now[/cmd] to be sent to the virtual machine, and then continue shutting down the host machine. Also, if I manually run:
[cmd=]/usr/local/etc/rc.d/freebsdvbox1 stop[/cmd]
The virtual machine shuts down gracefully.