/etc/init.d/wsv
#!/bin/sh
user=”wsv”
PATH=/home/only/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
DESC=”Virtual Box Wsv”
NAME=wsv
SCRIPTNAME=/etc/init.d/$NAME
VM_NAME=”Wsv”
USERNAME=only
do_start()
{
su $USERNAME -c “VBoxManage startvm ${VM_NAME} -type headless”
}
do_stop()
{
su $USERNAME -c “VBoxManage controlvm ${VM_NAME} acpipowerbutton && sleep 5”
}
case “$1” in
start)
echo -n “Starting $DESC: $NAME”
do_start
echo “.”
;;
stop)
echo -n “Stopping $DESC: $NAME”
do_stop
echo “.”
;;
restart|force-reload)
echo -n “not support”
;;
*)
echo “Usage: $SCRIPTNAME {start|stop|restart|force-reload}” >&2
exit 1
;;
esac
exit 0
뭐 이런식으로 ?
update-rc.d wsv defaults 99 1
맞나? (제일먼저 켜지고 제일먼저 꺼지게 )
뭐 하여튼 지금 이렇게 씀.
acpid 설치 필수 (안그러면 안꺼져 -_-)