-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvboxservice.init
executable file
·78 lines (68 loc) · 1.25 KB
/
vboxservice.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# vboxservice VirtualBox guest services
# chkconfig: 345 85 15
# description: VirtualBox guest services
# processname: VBoxService
# Source function library
. /etc/rc.d/init.d/functions
# Get service config - may override defaults
[ -f /etc/sysconfig/vboxservice ] && . /etc/sysconfig/vboxservice
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/vboxservice ]; then
msg_already_running "VBox Service"
return
fi
msg_starting "VBox Service"
daemon /usr/bin/VBoxService
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/vboxservice
}
stop() {
if [ ! -f /var/lock/subsys/vboxservice ]; then
msg_not_running "VBox Service"
return
fi
# Stop daemons.
msg_stopping "VBox Service"
killproc VBoxService
rm -f /var/lock/subsys/vboxservice
}
condrestart() {
if [ ! -f /var/lock/subsys/vboxservice ]; then
msg_not_running "VBox Service"
RETVAL=$1
return
fi
stop
start
}
RETVAL=0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
try-restart)
condrestart 0
;;
force-reload)
condrestart 7
;;
status)
status vboxservice VBoxService
RETVAL=$?
;;
*)
msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
exit 3
esac
exit $RETVAL