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