5 kx #!/bin/sh
5 kx #
5 kx # messagebus: The D-BUS systemwide message bus
5 kx #
5 kx # description: This is a daemon which broadcasts notifications of system events \
5 kx # and other messages. See http://www.freedesktop.org/software/dbus/
5 kx #
5 kx # processname: dbus-daemon
5 kx #
5 kx
5 kx # This is a modified version of the rc.messagebus script distributed with the
5 kx # dbus sources. Thanks to Don Tanner of the GWare <http://gware.org> Project
5 kx # for most of the work involved --Robby Workman <rworkman@slackware.com>
5 kx
5 kx
5 kx PIDFILE=/var/run/dbus/dbus.pid
5 kx
5 kx start() {
5 kx mkdir -p $(dirname $PIDFILE)
5 kx if ! ps -u messagebus -c | grep -wq dbus-daemon; then
5 kx rm -f $(dirname $PIDFILE)/*
5 kx if [ -x /usr/bin/dbus-uuidgen -a -x /usr/bin/dbus-daemon ] ; then
5 kx echo "Starting system message bus: /usr/bin/dbus-uuidgen --ensure ; /usr/bin/dbus-daemon --system"
5 kx /usr/bin/dbus-uuidgen --ensure
5 kx /usr/bin/dbus-daemon --system 1> /dev/null
5 kx fi
5 kx fi
5 kx }
5 kx
5 kx stop() {
5 kx if [ -e "$PIDFILE" ]; then
5 kx echo "Stopping system message bus..."
5 kx pid=$(cat $PIDFILE)
5 kx kill $pid 1> /dev/null 2> /dev/null
5 kx # Just in case:
5 kx killall dbus-daemon 1> /dev/null 2> /dev/null
5 kx rm -f $PIDFILE
5 kx fi
5 kx }
5 kx
5 kx reload() {
5 kx echo "Reloading system message bus configuration..."
5 kx if [ -e "$PIDFILE" ]; then
5 kx pid=$(cat $PIDFILE)
5 kx kill -HUP $pid
5 kx else
5 kx killall -HUP dbus-daemon
5 kx fi
5 kx }
5 kx
5 kx status() {
5 kx if ps -u messagebus -c | grep -wq dbus-daemon; then
5 kx echo "System dbus-daemon is running."
5 kx else
5 kx echo "System dbus-daemon is stopped."
5 kx fi
5 kx }
5 kx
5 kx # See how we were called.
5 kx case "$1" in
5 kx start)
5 kx start
5 kx ;;
5 kx stop)
5 kx stop
5 kx ;;
5 kx restart)
5 kx stop
5 kx start
5 kx echo "You may need to restart your Window Manager to reconnect to the system dbus."
5 kx ;;
5 kx reload)
5 kx reload
5 kx ;;
5 kx status)
5 kx status
5 kx ;;
5 kx *)
5 kx echo $"Usage: $0 {start|stop|restart|reload|status}"
5 kx ;;
5 kx esac