2003-03-31 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / bus / messagebus.in
1 #!/bin/sh
2 #
3 # messagebus:   The D-BUS systemwide message bus
4 #
5 # chkconfig: 345 97 03
6 # description:  This is a daemon which broadcasts notifications of system events \
7 #               and other messages. See http://www.freedesktop.org/software/dbus/
8 #
9 # processname: dbus-daemon-1
10 # pidfile: @EXPANDED_LOCALSTATEDIR@/messagebus.pid
11 #
12
13 # Sanity checks.
14 [ -x @EXPANDED_BINDIR@/dbus-daemon-1 ] || exit 0
15
16 # Source function library.
17 . @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions
18
19 RETVAL=0
20
21 start() {
22     echo -n $"Starting system message bus: "
23     daemon dbus-daemon-1 --system
24     RETVAL=$?
25     echo
26     [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
27 }
28
29 stop() {
30     echo -n $"Stopping system message bus: "
31     killproc messagebus
32     RETVAL=$?
33     echo
34     if [ $RETVAL -eq 0 ]; then
35         rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus
36     fi
37 }
38
39 # See how we were called.
40 case "$1" in
41     start)
42         start
43         ;;
44     stop)
45         stop
46         ;;
47     status)
48         status messagebus
49         RETVAL=$?
50         ;;
51     restart)
52         stop
53         start
54         ;;
55     condrestart)
56         if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/messagebus ]; then
57             stop
58             start
59         fi
60         ;;
61     reload)
62         killproc messagebus -HUP
63         RETVAL=$?
64         ;;
65     *)
66         echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
67         ;;
68 esac
69 exit $RETVAL