#!/bin/sh # dbus # Source functions library source /etc/rc.d/init.d/functions log_script_name "$0 $*" DAEMON=/usr/bin/dbus-daemon DAEMON_DESC="D-BUS Messagebus daemon" DAEMON_OPTS="--config-file=/etc/dbus-1/system.conf" dbus_start() { if statusproc ${DAEMON} | grep -q "stopped"; then if [ -f /var/run/dbus/pid ]; then rm /var/run/dbus/pid fi if [ -f /var/run/dbus/system_bus_socket ]; then rm /var/run/dbus/system_bus_socket fi else echo "Already running..." return ${EXIT_CODE_WARNING} fi loadproc ${DAEMON} ${DAEMON_OPTS} return $? } case "$1" in start) cmd_run_log_box_warn "${DAEMON_DESC} start" dbus_start ;; stop) cmd_run_log_box_warn "${DAEMON_DESC} stop" killproc ${DAEMON} && rm /var/run/dbus/pid && rm /var/run/dbus/system_bus_socket ;; status) statusproc ${DAEMON} ;; restart) $0 stop sleep 1 $0 start ;; *) echo "Usage: $0 {restart|start|status|stop}" exit ${EXIT_CODE_FAILURE} ;; esac exit $?