core/dbus-core/dbus

52 lines
1.1 KiB
Plaintext
Raw Normal View History

2010-03-13 23:25:19 +08:00
#!/bin/bash
# general config
. /etc/rc.conf
. /etc/rc.d/functions
2012-09-09 12:17:16 +08:00
case $1 in
2010-03-13 23:25:19 +08:00
start)
stat_busy "Starting D-BUS system messagebus"
2012-09-09 12:17:16 +08:00
if [[ ! -d /run/dbus ]] ; then
install -m755 -g 81 -o 81 -d /run/dbus
2010-03-13 23:25:19 +08:00
fi
2012-09-09 12:17:16 +08:00
if ! dbus-daemon --system; then
2010-03-13 23:25:19 +08:00
stat_fail
else
add_daemon dbus
stat_done
fi
;;
stop)
stat_busy "Stopping D-BUS system messagebus"
2012-09-09 12:17:16 +08:00
if ! { [[ -f /run/dbus/pid ]] && kill $(</run/dbus/pid); }; then
2010-03-13 23:25:19 +08:00
stat_fail
else
2012-09-09 12:17:16 +08:00
rm -f /run/dbus/pid
2010-03-13 23:25:19 +08:00
rm_daemon dbus
stat_done
fi
;;
restart)
2012-09-09 12:17:16 +08:00
$0 stop
sleep 1
$0 start
2010-03-13 23:25:19 +08:00
;;
reload)
stat_busy "Reloading D-BUS configuration"
2012-09-09 12:17:16 +08:00
if ! { [[ -f /run/dbus/pid ]] && dbus-send \
2010-03-13 23:25:19 +08:00
--system --type=method_call \
--dest=org.freedesktop.DBus \
2012-09-09 12:17:16 +08:00
/ org.freedesktop.DBus.ReloadConfig; }; then
2010-03-13 23:25:19 +08:00
stat_fail
else
stat_done
fi
;;
*)
echo "usage: $0 {start|stop|restart|reload}"
2012-09-09 12:17:16 +08:00
;;
2010-03-13 23:25:19 +08:00
esac
exit 0