Home | History | Annotate | Download | only in bus
      1 #!/bin/sh
      2 #
      3 # messagebus:   The D-BUS systemwide message bus
      4 #
      5 # chkconfig: 345 97 03
      6 # description:  This is a daemon which broadcasts notifications of system events \
      7 #               and other messages. See http://www.freedesktop.org/software/dbus/
      8 #
      9 # processname: dbus-daemon
     10 # pidfile: @DBUS_SYSTEM_PID_FILE@
     11 #
     12 
     13 # Sanity checks.
     14 [ -x @EXPANDED_BINDIR@/dbus-daemon ] || exit 0
     15 
     16 # Source function library.
     17 . @EXPANDED_SYSCONFDIR@/rc.d/init.d/functions
     18 
     19 # so we can rearrange this easily
     20 processname=dbus-daemon
     21 servicename=messagebus
     22 
     23 RETVAL=0
     24 
     25 start() {
     26     echo -n $"Starting system message bus: "
     27     if [ -x @EXPANDED_BINDIR@/dbus-uuidgen ] ; then
     28         @EXPANDED_BINDIR@/dbus-uuidgen --ensure
     29     fi
     30 
     31     daemon --check $servicename $processname --system
     32     RETVAL=$?
     33     echo
     34     [ $RETVAL -eq 0 ] && touch @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename
     35 }
     36 
     37 stop() {
     38     echo -n $"Stopping system message bus: "
     39 
     40     ## we don't want to kill all the per-user $processname, we want
     41     ## to use the pid file *only*; because we use the fake nonexistent 
     42     ## program name "$servicename" that should be safe-ish
     43     killproc $servicename -TERM
     44     RETVAL=$?
     45     echo
     46     if [ $RETVAL -eq 0 ]; then
     47         rm -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename
     48         rm -f @DBUS_SYSTEM_PID_FILE@
     49     fi
     50 }
     51 
     52 # See how we were called.
     53 case "$1" in
     54     start)
     55         start
     56         ;;
     57     stop)
     58         stop
     59         ;;
     60     status)
     61         status $processname
     62         RETVAL=$?
     63         ;;
     64     restart)
     65         stop
     66         start
     67         ;;
     68     condrestart)
     69         if [ -f @EXPANDED_LOCALSTATEDIR@/lock/subsys/$servicename ]; then
     70             stop
     71             start
     72         fi
     73         ;;
     74     reload)
     75         echo "Message bus can't reload its configuration, you have to restart it"
     76         RETVAL=$?
     77         ;;
     78     *)
     79         echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
     80         ;;
     81 esac
     82 exit $RETVAL
     83