S97messagebus 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: /var/run/messagebus.pid
  11. #
  12. # Sanity checks.
  13. [ -x /usr/bin/dbus-daemon ] || exit 0
  14. # Create needed directories.
  15. [ -d /var/run/dbus ] || mkdir -p /var/run/dbus
  16. [ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys
  17. RETVAL=0
  18. start() {
  19. echo -n "Starting system message bus: "
  20. dbus-uuidgen --ensure
  21. dbus-daemon --system
  22. RETVAL=$?
  23. echo "done"
  24. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbus-daemon
  25. }
  26. stop() {
  27. echo -n "Stopping system message bus: "
  28. ## we don't want to kill all the per-user $processname, we want
  29. ## to use the pid file *only*; because we use the fake nonexistent
  30. ## program name "$servicename" that should be safe-ish
  31. killall dbus-daemon
  32. RETVAL=$?
  33. echo "done"
  34. if [ $RETVAL -eq 0 ]; then
  35. rm -f /var/lock/subsys/dbus-daemon
  36. rm -f /var/run/messagebus.pid
  37. fi
  38. }
  39. # See how we were called.
  40. case "$1" in
  41. start)
  42. start
  43. ;;
  44. stop)
  45. stop
  46. ;;
  47. status)
  48. status $processname
  49. RETVAL=$?
  50. ;;
  51. restart)
  52. stop
  53. start
  54. ;;
  55. condrestart)
  56. if [ -f /var/lock/subsys/$servicename ]; then
  57. stop
  58. start
  59. fi
  60. ;;
  61. reload)
  62. echo "Message bus can't reload its configuration, you have to restart it"
  63. RETVAL=$?
  64. ;;
  65. *)
  66. echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
  67. ;;
  68. esac
  69. exit $RETVAL