2 # -*- coding: utf-8 -*-
3 # Debian init.d script for D-BUS
4 # Copyright © 2003 Colin Walters <walters@debian.org>
8 DAEMON=/usr/bin/dbus-daemon
14 DESC="system message bus"
15 EVENTDIR=/etc/dbus-1/event.d
17 test -x $DAEMON || exit 0
19 # Source defaults file; edit that file to configure this script.
22 if [ -e /etc/default/dbus ]; then
26 test "$ENABLED" != "0" || exit 0
30 if [ ! -d $PIDDIR ]; then
32 chown $DAEMONUSER $PIDDIR
33 chgrp $DAEMONUSER $PIDDIR
35 if [ -e $PIDFILE ]; then
36 PIDDIR=/proc/$(cat $PIDFILE)
37 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
38 echo "$DESC already started; not starting."
40 echo "Removing stale PID file $PIDFILE."
45 if [ ! -d $UUIDDIR ]; then
47 chown $DAEMONUSER $UUIDDIR
48 chgrp $DAEMONUSER $UUIDDIR
53 echo -n "Starting $DESC: "
54 start-stop-daemon --start --quiet --pidfile $PIDFILE \
55 --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
57 if [ -d $EVENTDIR ]; then
58 run-parts --arg=start $EVENTDIR
64 if [ -d $EVENTDIR ]; then
65 run-parts --reverse --arg=stop $EVENTDIR
67 echo -n "Stopping $DESC: "
68 start-stop-daemon --stop --quiet --pidfile $PIDFILE \
70 # We no longer include these arguments so that start-stop-daemon
71 # can do its job even given that we may have been upgraded.
72 # We rely on the pidfile being sanely managed
73 # --exec $DAEMON -- --system $PARAMS
91 echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2