- BR fltk-devel
[packages/VirtualBox.git] / vboxservice.init
1 #!/bin/sh
2 #
3 # vboxservice   VirtualBox guest services
4 # chkconfig:    345 85 15
5 # description:  VirtualBox guest services
6 # processname:  VBoxService
7
8 # Source function library
9 . /etc/rc.d/init.d/functions
10
11 # Get network config
12 . /etc/sysconfig/network
13
14 # Check that networking is up.
15 if is_yes "${NETWORKING}"; then
16         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
17                 msg_network_down "VBox Service"
18                 exit 1
19         fi
20 else
21         exit 0
22 fi
23
24 # Get service config - may override defaults
25 [ -f /etc/sysconfig/vboxservice ] && . /etc/sysconfig/vboxservice
26
27 start() {
28         # Check if the service is already running?
29         if [ -f /var/lock/subsys/vboxservice ]; then
30                 msg_already_running "VBox Service"
31                 return
32         fi
33
34         msg_starting "VBox Service"
35         daemon /usr/bin/VBoxService
36         RETVAL=$?
37         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/vboxservice
38 }
39
40 stop() {
41         if [ ! -f /var/lock/subsys/vboxservice ]; then
42                 msg_not_running "VBox Service"
43                 return
44         fi
45
46         # Stop daemons.
47         msg_stopping "VBox Service"
48         killproc VBoxService
49         rm -f /var/lock/subsys/vboxservice
50 }
51
52 condrestart() {
53         if [ ! -f /var/lock/subsys/vboxservice ]; then
54                 msg_not_running "VBox Service"
55                 RETVAL=$1
56                 return
57         fi
58
59         stop
60         start
61 }
62
63 RETVAL=0
64 # See how we were called.
65 case "$1" in
66   start)
67         start
68         ;;
69   stop)
70         stop
71         ;;
72   restart)
73         stop
74         start
75         ;;
76   try-restart)
77         condrestart 0
78         ;;
79   force-reload)
80         condrestart 7
81         ;;
82   status)
83         status vboxservice VBoxService
84         RETVAL=$?
85         ;;
86   *)
87         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
88         exit 3
89 esac
90
91 exit $RETVAL
This page took 0.034561 seconds and 3 git commands to generate.