VirtualBox

Ticket #2396: vbox-ipcop

File vbox-ipcop, 1.5 KB (added by ZioNemo, 16 years ago)

/etc/init.d/vbox-ipcop: script used to start/stop the Virtual Machine.

Line 
1#!/bin/sh
2# Start/stop the IPCop VM
3#
4### BEGIN INIT INFO
5# Provides: vbox-ipcop
6# Required-Start: $syslog $time vboxdrv vboxnet
7# Required-Stop: $syslog $time
8# Default-Start: 2 3 4 5
9# Default-Stop: 0 1 6
10# Short-Description: IPCop in Virtualbox VM
11# Description: IPCop in Virtualbox VM
12### END INIT INFO
13
14VBOXUSER=mauro
15VARRUNDIR=/var/run/VBoxHeadless
16PIDFILE=$VARRUNDIR/ipcop.pid
17VRDPADDR=192.168.0.5
18VRDPPORT=4000
19
20test -f /usr/bin/VBoxHeadless || exit 0
21
22. /lib/lsb/init-functions
23
24case "$1" in
25start) log_daemon_msg "Starting IPCop in Virtualbox" "VBoxHeadless"
26 mkdir -p $VARRUNDIR
27 chgrp vboxusers $VARRUNDIR
28 chmod g+ws $VARRUNDIR
29 USER=$VBOXUSER LOGNAME=$VBOXUSER start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE --name VBoxHeadless --chuid $VBOXUSER --startas /usr/bin/VBoxHeadless -- -s IPCop -a $VRDPADDR -p $VRDPPORT
30 /sbin/route add default gw 192.168.0.15
31 log_end_msg $?
32 ;;
33stop) log_daemon_msg "Stopping IPCop in Virtualbox" "VBoxHeadless"
34 /sbin/route del default gw 192.168.0.15
35 su -c '/usr/bin/VBoxManage controlvm IPCop keyboardputscancode 1d 38 53' $VBOXUSER
36 sleep 30
37 start-stop-daemon --stop --quiet --pidfile $PIDFILE --name VBoxHeadless
38 rm -f $PIDFILE
39 log_end_msg $?
40 ;;
41restart)
42 $0 stop
43 $0 start
44 ;;
45status)
46 su -c '/usr/bin/VBoxManage showvminfo IPCop' $VBOXUSER | grep '^State:'
47 ;;
48*) log_action_msg "Usage: /etc/init.d/vbox-ipcop {start|stop|restart|status}"
49 exit 2
50 ;;
51esac
52exit 0

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy