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.20110725.etc.tar.gz / bradford.20110725.etc.tar / etc / init.d / resmgr < prev    next >
Text File  |  2006-05-02  |  4KB  |  135 lines

  1. #!/bin/sh
  2. # Copyright (c) 2002-2005 SuSE Linux Products GmbH, Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Author: Olaf Kirch <okir@suse.de>
  6. #
  7. # /etc/init.d/resmgr
  8. #
  9. #   and it's symbolic link
  10. #
  11. # /usr/sbin/rcresmgr
  12. #
  13. ### BEGIN INIT INFO
  14. # Provides:       resmgr
  15. # Required-Start:
  16. # Should-Start:   boot.rootfsck
  17. # Required-Stop:
  18. # Default-Start:  2 3 5
  19. # Default-Stop:   0 1 6
  20. # Description:    Start resource manager for device file access
  21. ### END INIT INFO
  22.  
  23. # Check for missing binaries (stale symlinks should not happen)
  24. RESMGR_BIN=/sbin/resmgrd
  25. test -x $RESMGR_BIN || { echo "$RESMGR_BIN not installed";
  26.     if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; }
  27.  
  28. # Shell functions sourced from /etc/rc.status:
  29. #      rc_check         check and set local and overall rc status
  30. #      rc_status        check and set local and overall rc status
  31. #      rc_status -v     ditto but be verbose in local rc status
  32. #      rc_status -v -r  ditto and clear the local rc status
  33. #      rc_status -s     display "skipped" and exit with status 3
  34. #      rc_status -u     display "unused" and exit with status 3
  35. #      rc_failed        set local and overall rc status to failed
  36. #      rc_failed <num>  set local and overall rc status to <num>
  37. #      rc_reset         clear local rc status (overall remains)
  38. #      rc_exit          exit appropriate to overall rc status
  39. #      rc_active    checks whether a service is activated by symlinks
  40. #      rc_splash arg    sets the boot splash screen to arg (if active)
  41. . /etc/rc.status
  42.  
  43. # First reset status of this service
  44. rc_reset
  45.  
  46. # Return values acc. to LSB for all commands but status:
  47. # 0      - success
  48. # 1       - generic or unspecified error
  49. # 2       - invalid or excess argument(s)
  50. # 3       - unimplemented feature (e.g. "reload")
  51. # 4       - user had insufficient privileges
  52. # 5       - program is not installed
  53. # 6       - program is not configured
  54. # 7       - program is not running
  55. # 8--199  - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
  56. #
  57. # Note that starting an already running service, stopping
  58. # or restarting a not-running service as well as the restart
  59. # with force-reload (in case signaling is not supported) are
  60. # considered a success.
  61.  
  62. case "$1" in
  63.     start)
  64.         echo -n "Starting resource manager"
  65.     if checkproc $RESMGR_BIN; then
  66.         rc_status -v
  67.     else
  68.         (cd /var/run/resmgr/classes && /bin/rm -rf -- *)
  69.         startproc $RESMGR_BIN
  70.         rc_status -v
  71.         if [ -x /usr/sbin/hal-resmgr ] && checkproc /usr/sbin/hald; then
  72.             echo -n "  hald already running, registering devices"
  73.             /usr/sbin/hal-resmgr
  74.             rc_status -v
  75.         fi
  76.     fi
  77.     ;;
  78.     stop)
  79.     echo -n "Shutting down resource manager"
  80.     # LSB requires that we exit with 0 even if the
  81.     # server wasn't running.
  82.     $RESMGR_BIN -k || true
  83.     rc_status -v
  84.     (cd /var/run/resmgr/classes && /bin/rm -rf -- *)
  85.     ;;
  86.    try-restart|condrestart)
  87.         ## Do a restart only if the service was active before.
  88.         ## Note: try-restart is now part of LSB (as of 1.9).
  89.         ## RH has a similar command named condrestart.
  90.         if test "$1" = "condrestart"; then
  91.                 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
  92.         fi
  93.         $0 status
  94.         if test $? = 0; then
  95.                 $0 restart
  96.         else
  97.                 rc_reset        # Not running is not a failure.
  98.         fi
  99.         rc_status
  100.         ;;
  101.     restart)
  102.     /sbin/resmgr dump dynamic-devices sessions grants > /var/run/resmgr.sessions 2>/dev/null
  103.     $0 stop
  104.     $0 start
  105.     /sbin/resmgr < /var/run/resmgr.sessions > /dev/null
  106.     rc_status
  107.     /bin/rm -f /var/run/resmgr.sessions
  108.     ;;
  109.     force-reload)
  110.     echo -n "Reload resource manager"
  111.     $0 try-restart
  112.     rc_status
  113.     ;;
  114.     reload)
  115.     echo -n "Reload resource manager"
  116.     rc_failed 3
  117.     rc_status -v
  118.     ;;
  119.     status)
  120.     echo -n "Checking for resource manager: "
  121.     checkproc $RESMGR_BIN
  122.     rc_status -v
  123.     ;;
  124.     probe)
  125.         if [ /etc/resmgr.conf -nt /var/run/resmgr.pid ]; then
  126.         echo restart
  127.     fi
  128.     ;;
  129.     *)
  130.     echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
  131.     exit 1
  132.     ;;
  133. esac
  134. rc_exit
  135.