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
10# pidfile: /usr/var/run/messagebus.pid
11#
12
13# Sanity checks.
14#[ -x /usr/bin/dbus-daemon ] || exit 0
15
16# Source function library.
17#. /usr/etc/rc.d/init.d/functions
18
19# so we can rearrange this easily
20#processname=dbus-daemon
21#servicename=messagebus
22
23#RETVAL=0
24
25start() {
26    echo "Starting system message bus"
27    if [ -x /usr/bin/dbus-uuidgen ] ; then
28        /usr/bin/dbus-uuidgen --ensure
29    fi
30
31    if [ -x /usr/bin/dbus-daemon ];then
32    	/usr/bin/dbus-daemon --system
33    fi
34    #daemon --check $servicename $processname --system
35    #RETVAL=$?
36    #echo
37    #[ $RETVAL -eq 0 ] && touch /usr/var/lock/subsys/$servicename
38}
39
40stop() {
41    echo "Stopping system message bus"
42
43    ## we don't want to kill all the per-user $processname, we want
44    ## to use the pid file *only*; because we use the fake nonexistent 
45    ## program name "$servicename" that should be safe-ish
46    killall dbus-daemon
47    #RETVAL=$?
48    #echo
49    #if [ $RETVAL -eq 0 ]; then
50    #    rm -f /usr/var/lock/subsys/$servicename
51    #    rm -f /usr/var/run/messagebus.pid
52    #fi
53}
54
55# See how we were called.
56case "$1" in
57    start)
58        start
59        ;;
60    stop)
61        stop
62        ;;
63    status)
64        status $servicename
65        RETVAL=$?
66        ;;
67    restart)
68        stop
69        start
70        ;;
71    reload)
72        echo "Message bus can't reload its configuration, you have to restart it"
73        RETVAL=$?
74        ;;
75    *)
76        echo $"Usage: $0 {start|stop|status|restart|reload}"
77        ;;
78esac
79exit $RETVAL
80