aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dbus/dbus/dbus-1.init
blob: 118b801da77b8bc3cb9aa33723d5c61272af57a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/sh
# -*- coding: iso8859-1 -*-
# Debian init.d script for D-BUS
# Copyright (c) 2003 Colin Walters <walters@debian.org>

set -e

DAEMON=/usr/bin/dbus-daemon-1
NAME=dbus-1
DAEMONUSER=messagebus
PIDFILE=/var/run/dbus/pid
DESC="system message bus"

test -x $DAEMON || exit 0

# Source defaults file; edit that file to configure this script.
ENABLED=1
PARAMS=""
if [ -e /etc/default/dbus-1 ]; then
	. /etc/default/dbus-1
fi

test "$ENABLED" != "0" || exit 0

case "$1" in
  start)
	echo -n "Starting $DESC: "
	if [ ! -d /var/run/dbus ]; then
		mkdir /var/run/dbus
		chown $DAEMONUSER:$DAEMONUSER /var/run/dbus
	fi
	start-stop-daemon -S \
		-u $DAEMONUSER -x $DAEMON -- --system $PARAMS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon -K \
		-u $DAEMONUSER -x $DAEMON -- --system $PARAMS
	echo "$NAME."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: "
	start-stop-daemon -K \
		 -u $DAEMONUSER -x $DAEMON -- --system $PARAMS
	sleep 1
	start-stop-daemon -S \
		 -u $DAEMONUSER -x $DAEMON -- --system $PARAMS
	echo "$NAME."
	;;
  *)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0