opt/dbus/rc.dbus

40 lines
893 B
Plaintext
Raw Normal View History

#!/bin/sh
#
# /etc/rc.d/dbus: start/stop dbus messagebus daemon
#
2015-06-28 00:12:20 +02:00
SSD=/sbin/start-stop-daemon
PROG=/usr/sbin/dbus-daemon
2019-06-09 18:48:47 +02:00
PID=/var/run/dbus/dbus.pid
2015-06-28 00:12:20 +02:00
OPTS="--system"
case $1 in
2019-06-09 18:48:47 +02:00
start)
if [ ! -f /var/lib/dbus/machine-id ]
then
/usr/bin/dbus-uuidgen --ensure
fi
$SSD --start --pidfile=$PID --exec $PROG -- $OPTS
2015-06-28 00:12:20 +02:00
;;
stop)
2019-06-09 18:48:47 +02:00
$SSD --stop --remove-pidfile --retry 10 --pidfile=$PID
2015-06-28 00:12:20 +02:00
;;
restart)
$0 stop
$0 start
;;
status)
$SSD --status --exec $PROG
case $? in
2019-06-09 18:48:47 +02:00
0) echo "$PROG is running with pid $(cat $PID)" ;;
2015-06-28 00:12:20 +02:00
1) echo "$PROG is not running but the pid file $PID exists" ;;
3) echo "$PROG is not running" ;;
4) echo "Unable to determine the program status" ;;
esac
;;
*)
echo "usage: $0 [start|stop|restart|status]"
;;
esac