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-1
13 DESC="system message bus"
14 EVENTDIR=/etc/dbus-1/event.d
16 test -x $DAEMON || exit 0
18 # Source defaults file; edit that file to configure this script.
21 if [ -e /etc/default/dbus-1 ]; then
25 test "$ENABLED" != "0" || exit 0
29 if [ ! -d $PIDDIR ]; then
31 chown $DAEMONUSER $PIDDIR
32 chgrp $DAEMONUSER $PIDDIR
34 if [ -e $PIDFILE ]; then
35 PIDDIR=/proc/$(cat $PIDFILE)
36 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then
37 echo "$DESC already started; not starting."
39 echo "Removing stale PID file $PIDFILE."
43 echo -n "Starting $DESC: "
44 start-stop-daemon --start --quiet --pidfile $PIDFILE \
45 --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
47 if [ -d $EVENTDIR ]; then
48 run-parts --arg=start $EVENTDIR
54 if [ -d $EVENTDIR ]; then
55 run-parts --reverse --arg=stop $EVENTDIR
57 echo -n "Stopping $DESC: "
58 start-stop-daemon --stop --quiet --pidfile $PIDFILE \
60 # We no longer include these arguments so that start-stop-daemon
61 # can do its job even given that we may have been upgraded.
62 # We rely on the pidfile being sanely managed
63 # --exec $DAEMON -- --system $PARAMS
81 echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2