]> git.pld-linux.org Git - packages/dbus.git/blob - messagebus.init
- updated for 1.2.20
[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                 daemon --pidfile dbus.pid /usr/bin/dbus-daemon --system
38                 RETVAL=$?
39                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/messagebus
40         else
41                 msg_already_running messagebus
42         fi
43 }
44
45 stop() {
46         if [ -f /var/lock/subsys/messagebus ]; then
47                 # Stop daemons.
48                 msg_stopping messagebus
49                 killproc --pidfile dbus.pid dbus-daemon
50                 rm -f /var/lock/subsys/messagebus
51                 rm -f /var/run/dbus.pid
52         else
53                 msg_not_running messagebus
54         fi
55 }
56
57 condrestart() {
58         if [ -f /var/lock/subsys/cpqarrayd ]; then
59                 stop
60                 start
61         else
62                 msg_not_running messagebus
63                 RETVAL=$1
64         fi
65 }
66
67 RETVAL=0
68 # See how we were called.
69 case "$1" in
70   start)
71         start
72         ;;
73   stop)
74         stop
75         ;;
76   restart)
77         stop
78         start
79         ;;
80   try-restart)
81         condrestart 0
82         ;;
83   reload|force-reload)
84         if [ -f /var/lock/subsys/messagebus ]; then
85                 msg_reloading messagebus
86                 killproc dbus-daemon -HUP
87                 RETVAL=$?
88         else
89                 msg_not_running messagebus
90                 RETVAL=7
91         fi
92         ;;
93   status)
94         status messagebus dbus-daemon
95         RETVAL=$?
96         ;;
97   *)
98         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
99         exit 3
100 esac
101
102 exit $RETVAL
This page took 0.046826 seconds and 3 git commands to generate.