4 # Required-Start: $remote_fs $syslog
5 # Required-Stop: $remote_fs $syslog
6 # Default-Start: 2 3 4 5
8 # Short-Description: D-Bus systemwide message bus
9 # Description: D-Bus is a simple interprocess messaging system, used
10 # for sending messages between applications.
13 # -*- coding: utf-8 -*-
14 # Debian init.d script for D-BUS
15 # Copyright © 2003 Colin Walters <walters@debian.org>
19 # Source function library.
20 . /etc/init.d/functions
22 DAEMON=@bindir@/dbus-daemon
24 DAEMONUSER=messagebus # must match /etc/dbus-1/system.conf
25 PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf
27 DESC="system message bus"
28 EVENTDIR=/etc/dbus-1/event.d
30 test -x $DAEMON || exit 0
32 # Source defaults file; edit that file to configure this script.
35 if [ -e /etc/default/dbus ]; then
39 test "$ENABLED" != "0" || exit 0
43 mkdir -p "`dirname $PIDFILE`"
44 if [ -e $PIDFILE ]; then
45 PIDDIR=/proc/$(cat $PIDFILE)
46 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
47 echo "$DESC already started; not starting."
49 echo "Removing stale PID file $PIDFILE."
54 if [ ! -d $UUIDDIR ]; then
56 chown $DAEMONUSER $UUIDDIR
57 chgrp $DAEMONUSER $UUIDDIR
62 echo -n "Starting $DESC: "
63 start-stop-daemon -o --start --quiet --pidfile $PIDFILE \
64 --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
66 if [ -d $EVENTDIR ]; then
67 run-parts --arg=start $EVENTDIR
73 if [ -d $EVENTDIR ]; then
74 # TODO: --reverse when busybox supports it
75 run-parts --arg=stop $EVENTDIR
77 echo -n "Stopping $DESC: "
78 start-stop-daemon -o --stop --quiet --pidfile $PIDFILE \
80 # We no longer include these arguments so that start-stop-daemon
81 # can do its job even given that we may have been upgraded.
82 # We rely on the pidfile being sanely managed
83 # --exec $DAEMON -- --system $PARAMS
90 echo -n "Reloading $DESC config: "
91 dbus-send --print-reply --system --type=method_call \
92 --dest=org.freedesktop.DBus \
93 / org.freedesktop.DBus.ReloadConfig > /dev/null
94 # hopefully this is enough time for dbus to reload it's config file.
118 echo "Usage: /etc/init.d/$NAME {start|stop|status|restart|reload|force-reload}" >&2