S30dbus 1.6 KB

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