]> git.pld-linux.org Git - packages/dbus.git/blob - messagebus.init
- updated to 1.2.4
[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 # Get network config
16 . /etc/sysconfig/network
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network ]; then
21                 msg_network_down messagebus
22                 exit 1
23         fi
24 else
25         exit 0
26 fi
27
28 start() {
29         # Check if the service is already running?
30         if [ ! -f /var/lock/subsys/messagebus ]; then
31                 msg_starting messagebus
32                 # if capability is modular, load it
33                 if modinfo capability >/dev/null 2>&1; then
34                         modprobe -s capability
35                 fi
36                 dbus-uuidgen --ensure
37                 rm -f /var/run/dbus.pid
38                 daemon /usr/bin/dbus-daemon --system
39                 RETVAL=$?
40                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/messagebus
41         else
42                 msg_already_running messagebus
43         fi
44 }
45
46 stop() {
47         if [ -f /var/lock/subsys/messagebus ]; then
48                 # Stop daemons.
49                 msg_stopping messagebus
50                 killproc --pidfile dbus.pid dbus-daemon
51                 rm -f /var/lock/subsys/messagebus
52                 rm -f /var/run/dbus.pid
53         else
54                 msg_not_running messagebus
55         fi
56 }
57
58 condrestart() {
59         if [ -f /var/lock/subsys/cpqarrayd ]; then
60                 stop
61                 start
62         else
63                 msg_not_running messagebus
64                 RETVAL=$1
65         fi
66 }
67
68 RETVAL=0
69 # See how we were called.
70 case "$1" in
71   start)
72         start
73         ;;
74   stop)
75         stop
76         ;;
77   restart)
78         stop
79         start
80         ;;
81   try-restart)
82         condrestart 0
83         ;;
84   reload|force-reload)
85         if [ -f /var/lock/subsys/messagebus ]; then
86                 msg_reloading messagebus
87                 killproc dbus-daemon -HUP
88                 RETVAL=$?
89         else
90                 msg_not_running messagebus
91                 RETVAL=7
92         fi
93         ;;
94   status)
95         status messagebus dbus-daemon
96         RETVAL=$?
97         ;;
98   *)
99         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
100         exit 3
101 esac
102
103 exit $RETVAL
This page took 0.119129 seconds and 3 git commands to generate.