S30dbus 1.7 KB

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