]> git.pld-linux.org Git - packages/dbus.git/blob - messagebus.init
- upstart: upstart_controlled early
[packages/dbus.git] / messagebus.init
1 #!/bin/sh
2 #
3 # messagebus    The D-BUS systemwide message bus
4 #
5 # chkconfig:    345 22 85
6 #
7 # description:  This is a daemon which broadcasts notifications of system
8 #               events and other messages.
9 #
10 # pidfile:      /var/run/dbus.pid
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 upstart_controlled
16
17 # Get network config
18 . /etc/sysconfig/network
19
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22         if [ ! -f /var/lock/subsys/network ]; then
23                 msg_network_down "D-BUS Message bus"
24                 exit 1
25         fi
26 else
27         exit 0
28 fi
29
30 start() {
31         # Check if the service is already running?
32         if [ -f /var/lock/subsys/messagebus ]; then
33                 msg_already_running "D-BUS Message bus"
34                 return
35         fi
36
37         emit starting JOB=messagebus
38         msg_starting "D-BUS Message bus"
39         # if capability is modular, load it
40         if modinfo capability >/dev/null 2>&1; then
41                 modprobe -s capability
42         fi
43         dbus-uuidgen --ensure
44         daemon --pidfile dbus.pid /usr/bin/dbus-daemon --system
45         RETVAL=$?
46         if [ $RETVAL -eq 0 ] ; then
47                 touch /var/lock/subsys/messagebus
48                 emit --no-wait started JOB=messagebus
49         fi
50 }
51
52 stop() {
53         if [ ! -f /var/lock/subsys/messagebus ]; then
54                 msg_not_running "D-BUS Message bus"
55                 return
56         fi
57
58         # Stop daemons.
59         emit stopping JOB=messagebus
60         msg_stopping "D-BUS Message bus"
61         killproc --pidfile dbus.pid dbus-daemon
62         rm -f /var/lock/subsys/messagebus /var/run/dbus.pid
63         emit --no-wait stopped JOB=messagebus
64 }
65
66 condrestart() {
67         if [ ! -f /var/lock/subsys/messagebus ]; then
68                 msg_not_running "D-BUS Message bus"
69                 RETVAL=$1
70                 return
71         fi
72
73         stop
74         start
75 }
76
77 reload() {
78         if [ ! -f /var/lock/subsys/messagebus ]; then
79                 msg_not_running "D-BUS Message bus"
80                 RETVAL=7
81                 return
82         fi
83
84         msg_reloading "D-BUS Message bus"
85         killproc --pidfile dbus.pid dbus-daemon -HUP
86         RETVAL=$?
87 }
88
89 RETVAL=0
90 # See how we were called.
91 case "$1" in
92   start)
93         start
94         ;;
95   stop)
96         stop
97         ;;
98   restart)
99         stop
100         start
101         ;;
102   try-restart)
103         condrestart 0
104         ;;
105   reload|force-reload)
106         reload
107         ;;
108   status)
109         status --pidfile dbus.pid messagebus dbus-daemon
110         RETVAL=$?
111         ;;
112   *)
113         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
114         exit 3
115 esac
116
117 exit $RETVAL
This page took 0.034108 seconds and 3 git commands to generate.