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 / haldaemon < prev    next >
Text File  |  2007-01-31  |  4KB  |  125 lines

  1. #!/bin/sh
  2. # Author: Danny Kukawka <dkukawka@suse.de>
  3. #
  4. # /etc/init.d/rchal
  5. #
  6. ### BEGIN INIT INFO
  7. # Provides:          haldaemon
  8. # Required-Start:    boot.localnet dbus 
  9. # Should-Start:      acpid resmgr
  10. # Required-Stop:     
  11. # Should-Stop:
  12. # Default-Start:     3 5
  13. # Default-Stop:      
  14. # Short-Description: HAL is a daemon for managing information about the hardware on the system
  15. # Description:       HAL is a hardware abstraction layer and aims to provide a live list of devices present 
  16. #             in the system at any point in time. HAL tries to understand both physical devices (such 
  17. #                as PCI, USB) and the device classes (such as input, net and block) physical devices have, 
  18. #             and it allows merging of information from so called device info files specific to a device. 
  19. #             HAL provides a network API through D-BUS for querying devices and notifying when things 
  20. #             change. Finally, HAL provides some monitoring (in an unintrusive way) of devices, presently 
  21. #             ethernet link detection and volume mounts are monitored. This, and more, is all described 
  22. #             in the HAL specification
  23. #                    
  24. ### END INIT INFO
  25.  
  26. # Check for binary
  27. HALDAEMON_BIN=/usr/sbin/hald
  28. test -x $HALDAEMON_BIN || exit 5
  29.  
  30. # Parameters (startup)
  31. HALDAEMON_PARA="--daemon=yes --retain-privileges";
  32. HALDAEMON_PIDDIR="/var/run/hal";
  33. HALDAEMON_PID=$HALDAEMON_PIDDIR/haldaemon.pid;
  34. DBUSDAEMON_PIDDIR="/var/run/dbus";
  35. DBUSDAEMON_PID=$DBUSDAEMON_PIDDIR/pid;
  36.  
  37. # Source LSB init functions
  38. # providing start_daemon, killproc, pidofproc,
  39. # log_success_msg, log_failure_msg and log_warning_msg.
  40. # This is currently not used by UnitedLinux based distributions and
  41. # not needed for init scripts for UnitedLinux only. If it is used,
  42. # the functions from rc.status should not be sourced or used.
  43. #. /lib/lsb/init-functions
  44.  
  45. . /etc/rc.status
  46.  
  47. # Reset status of this service
  48. rc_reset
  49.  
  50. case "$1" in
  51.     start)
  52.     
  53.     if [ ! -d $HALDAEMON_PIDDIR ]; then
  54.                 mkdir -p $HALDAEMON_PIDDIR;
  55.                 chown haldaemon:haldaemon $HALDAEMON_PIDDIR;
  56.         fi
  57.         if [ -e $HALDAEMON_PID ]; then
  58.                 if checkproc $HALDAEMON_BIN ; then
  59.             echo "HAL already started. Not starting."
  60.             exit 0;
  61.                 else
  62.                         echo "Removing stale PID file $HALDAEMON_PID.";
  63.                         rm -f $HALDAEMON_PID;
  64.                 fi
  65.         fi
  66. #    if [ ! -e $DBUSDAEMON_PID ]; then
  67. #        echo "DBUS is not running. Please start DBUS (or try 'rchal start-with-dbus').";
  68. #        exit 1;
  69. #    fi
  70.         
  71.     echo -n "Starting HAL daemon";
  72.         startproc -p $HALDAEMON_PID $HALDAEMON_BIN $HALDAEMON_PARA
  73.         rc_status -v
  74.         ;;
  75.     start-with-dbus)
  76.     if [ ! -e $DBUSDAEMON_PID ]; then
  77.                echo -n "DBUS is not running. Starting D-BUS daemon";
  78.                 rcdbus start;
  79.         fi
  80.     $0 start
  81.     ;;
  82.     stop)
  83.     echo -n "Shutting down HAL daemon"
  84.            killproc -p $HALDAEMON_PID -TERM $HALDAEMON_BIN
  85.            rc_status
  86.     rm -f $HALDAEMON_PID;
  87.            rc_status -v
  88.         ;;
  89.     try-restart)
  90.         $0 status >/dev/null &&  $0 restart
  91.         rc_status
  92.         ;;
  93.     restart)
  94.         $0 stop
  95.         $0 start
  96.         ;;
  97.     force-reload)
  98.         echo -n "Reload service HAL daemon"
  99.         $0 stop  &&  $0 start
  100.         rc_status
  101.         ;;
  102.     reload)
  103.         rc_failed 3
  104.         rc_status -v
  105.         ;;
  106.     status)
  107.         echo -n "Checking for service HAL daemon"
  108.         checkproc $HALDAEMON_BIN
  109.         rc_status -v
  110.         ;;
  111.     probe)
  112.         ## Optional: Probe for the necessity of a reload, print out the
  113.         ## argument to this init script which is required for a reload.
  114.         ## Note: probe is not (yet) part of LSB (as of 1.2)
  115.         # test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
  116.         ;;
  117.     *)
  118.         echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|start-with-dbus|reload|probe}"
  119.         exit 1
  120.         ;;
  121. esac
  122. rc_exit
  123.  
  124.  
  125.