home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20120305.etc.tar.gz / bradford.20120305.etc.tar / etc / init.d / dbus < prev    next >
Text File  |  2006-05-02  |  3KB  |  105 lines

  1. #!/bin/sh
  2. # Author: Timo Hoenig <thoenig@suse.de>
  3. #
  4. # /etc/init.d/dbus
  5. #
  6. ### BEGIN INIT INFO
  7. # Provides:          dbus
  8. # Required-Start:
  9. # Should-Start:
  10. # Required-Stop:     
  11. # Should-Stop:
  12. # Default-Start:     3 5
  13. # Default-Stop:      
  14. # Short-Description: D-BUS is a message bus system for applications to talk to one another.
  15. # Description:       D-BUS supplies both a system daemon (for events such as "new hardware device added"
  16. #                    or "printer queue changed") and a per-user-login-session daemon (for general IPC needs
  17. #                    among user applications). Also, the message bus is built on top of a general one-to-one
  18. #                    message passing framework, which can be used by any two apps to communicate directly
  19. #                    (without going through the message bus daemon).
  20. ### END INIT INFO
  21.  
  22. # Check for binary
  23. DBUSDAEMON_BIN=/usr/bin/dbus-daemon
  24. test -x $DBUSDAEMON_BIN || exit 5
  25.  
  26. # Parameters (startup)
  27. DBUSDAEMON_PARA="--system";
  28. DBUSDAEMON_PIDDIR="/var/run/dbus";
  29. DBUSDAEMON_PID=$DBUSDAEMON_PIDDIR/pid;
  30.  
  31. # Source LSB init functions
  32. # providing start_daemon, killproc, pidofproc, 
  33. # log_success_msg, log_failure_msg and log_warning_msg.
  34. # This is currently not used by UnitedLinux based distributions and
  35. # not needed for init scripts for UnitedLinux only. If it is used,
  36. # the functions from rc.status should not be sourced or used.
  37. #. /lib/lsb/init-functions
  38.  
  39. . /etc/rc.status
  40.  
  41. # Reset status of this service
  42. rc_reset
  43.  
  44. case "$1" in
  45.     start)
  46.     if [ ! -d $DBUSDAEMON_PIDDIR ]; then
  47.         mkdir -p $DBUSDAEMON_PIDDIR;
  48.         chown messagebus:messagebus $DBUSDAEMON_PIDDIR;
  49.     fi
  50.     if [ -e $DBUSDAEMON_PID ]; then
  51.         if [ -d /proc/`cat $DBUSDAEMON_PID` ]; then
  52.             echo "D-BUS already started. Not starting."
  53.             exit 0;
  54.         else
  55.             echo "Removing stale PID file $DBUSDAEMON_PID.";
  56.             rm -f $DBUSDAEMON_PID;
  57.         fi
  58.     fi    
  59.     echo -n "Starting D-BUS daemon";
  60.     startproc -f -p $DBUSDAEMON_PID $DBUSDAEMON_BIN $DBUSDAEMON_PARA
  61.     rc_status -v
  62.     ;;
  63.     stop)
  64.     echo -n "Shutting down D-BUS daemon"
  65.     killproc -p $DBUSDAEMON_PID -TERM $DBUSDAEMON_BIN
  66.     rm -f $DBUSDAEMON_PID;
  67.     rc_status -v
  68.     ;;
  69.     try-restart)
  70.     $0 status >/dev/null &&  $0 restart
  71.     rc_status
  72.     ;;
  73.     restart)
  74.     $0 stop
  75.     $0 start
  76.     rc_status
  77.     ;;
  78.     force-reload)
  79.     echo -n "Reload service D-BUS daemon"
  80.     $0 stop  &&  $0 start
  81.     rc_status
  82.     ;;
  83.     reload)
  84.     rc_failed 3
  85.     rc_status -v
  86.     ;;
  87.     status)
  88.     echo -n "Checking for service D-BUS daemon"
  89.     checkproc $DBUSDAEMON_BIN
  90.     rc_status -v
  91.     ;;
  92.     probe)
  93.     ## Optional: Probe for the necessity of a reload, print out the
  94.     ## argument to this init script which is required for a reload.
  95.     ## Note: probe is not (yet) part of LSB (as of 1.2)
  96.     # test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
  97.     ;;
  98.     *)
  99.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  100.     exit 1
  101.     ;;
  102. esac
  103. rc_exit
  104.  
  105.