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 / mdadmd < prev    next >
Text File  |  2006-05-03  |  4KB  |  151 lines

  1. #! /bin/sh
  2. # Copyright (c) 1995-2002 SuSE Linux AG, Nuernberg, Germany.
  3. # All rights reserved.
  4. #
  5. # Author: Petr Ostadal, feedback to http://www.suse.de/feedback
  6. #
  7. # /etc/init.d/mdadmd
  8. #
  9. #   and its symbolic link
  10. #
  11. # /usr/sbin/rcmdadmd
  12. #
  13. ### BEGIN INIT INFO
  14. # Provides:          mdadmd
  15. # Required-Start:    $local_fs
  16. # X-UnitedLinux-Should-Start:  $time sendmail
  17. # Required-Stop:     $local_fs
  18. # X-UnitedLinux-Should-Stop: $time sendmail
  19. # Default-Start:     3 5
  20. # Default-Stop:      0 1 2 6
  21. # Short-Description: mdadmd daemon monitoring MD devices
  22. # Description:       Start mdadmd to allow monitoring MD devices aka
  23. #    Linux Software Raid. This is only meaningful for raid1, raid5
  24. #    or  multipath arrays as only these have interesting state.
  25. #    raid0 or linear never have missing, spare, or failed drives, 
  26. #    so there is nothing to monitor.
  27. ### END INIT INFO
  28.  
  29. mdadmd_BIN=/sbin/mdadm
  30. test -x $mdadmd_BIN || exit 5
  31.  
  32. mdadmd_CONFIG=/etc/sysconfig/mdadm
  33. test -r $mdadmd_CONFIG || exit 6
  34. . $mdadmd_CONFIG
  35.  
  36. if [ x$MDADM_DELAY = x"" ]; then
  37.   MDADM_DELAY=60
  38. fi
  39. MDADM_DELAY="-d "$MDADM_DELAY;  
  40.  
  41. if [ x$MDADM_MAIL != x"" ]; then
  42.   MDADM_MAIL="-m \"$MDADM_MAIL\""
  43. fi
  44.  
  45. if [ x$MDADM_PROGRAM != x"" ]; then
  46.   MDADM_PROGRAM="-p \"$MDADM_PROGRAM\""
  47. fi
  48.  
  49. if [ x$MDADM_SCAN = x"yes" ]; then
  50.   MDADM_SCAN="-s"
  51. else
  52.   MDADM_SCAN=""
  53. fi
  54.  
  55. if [ x$MDADM_SEND_MAIL_ON_START = x"yes" ]; then
  56.   MDADM_SEND_MAIL="-t"
  57. else
  58.   MDADM_SEND_MAIL=""
  59. fi
  60.  
  61. if [ x$MDADM_CONFIG != x"" ]; then
  62.   MDADM_CONFIG="-c \"$MDADM_CONFIG\""
  63. fi
  64.  
  65. . /etc/rc.status
  66.  
  67. # Reset status of this service
  68. rc_reset
  69.  
  70. # Return values acc. to LSB for all commands but status:
  71. # 0      - success
  72. # 1       - generic or unspecified error
  73. # 2       - invalid or excess argument(s)
  74. # 3       - unimplemented feature (e.g. "reload")
  75. # 4       - user had insufficient privileges
  76. # 5       - program is not installed
  77. # 6       - program is not configured
  78. # 7       - program is not running
  79. # 8--199  - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
  80. # Note that starting an already running service, stopping
  81. # or restarting a not-running service as well as the restart
  82. # with force-reload (in case signaling is not supported) are
  83. # considered a success.
  84.  
  85. case "$1" in
  86.     start)
  87.     echo -n "Starting mdadmd "
  88.     ## Start daemon with startproc(8). If this fails
  89.     ## the return value is set appropriately by startproc.
  90.     eval startproc -q -s $mdadmd_BIN -F $MDADM_RAIDDEVICES $MDADM_DELAY $MDADM_MAIL $MDADM_PROGRAM $MDADM_SCAN $MDADM_SEND_MAIL $MDADM_CONFIG 
  91.  
  92.     # Remember status and be verbose
  93.     rc_status -v
  94.     ;;
  95.     stop)
  96.     echo -n "Shutting down mdadmd "
  97.     ## Stop daemon with killproc(8) and if this fails
  98.     ## killproc sets the return value according to LSB.
  99.  
  100.     killproc -TERM $mdadmd_BIN
  101.  
  102.     # Remember status and be verbose
  103.     rc_status -v
  104.     ;;
  105.     try-restart)
  106.     ## Do a restart only if the service was active before.
  107.     ## Note: try-restart is not (yet) part of LSB (as of 1.2)
  108.     $0 status >/dev/null &&  $0 restart
  109.  
  110.     # Remember status and be quiet
  111.     rc_status
  112.     ;;
  113.     restart)
  114.     ## Stop the service and regardless of whether it was
  115.     ## running or not, start it again.
  116.     $0 stop
  117.     $0 start
  118.  
  119.     # Remember status and be quiet
  120.     rc_status
  121.     ;;
  122.     reload)
  123.         exit 3
  124.         ;;
  125.     status)
  126.     echo -n "Checking for service mdadmd "
  127.     ## Check status with checkproc(8), if process is running
  128.     ## checkproc will return with exit status 0.
  129.  
  130.     # Return value is slightly different for the status command:
  131.     # 0 - service up and running
  132.     # 1 - service dead, but /var/run/  pid  file exists
  133.     # 2 - service dead, but /var/lock/ lock file exists
  134.     # 3 - service not running (unused)
  135.     # 4 - service status unknown :-(
  136.     # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
  137.     
  138.     # NOTE: checkproc returns LSB compliant status values.
  139.     checkproc $mdadmd_BIN
  140.     # NOTE: rc_status knows that we called this init script with
  141.     # "status" option and adapts its messages accordingly.
  142.     rc_status -v
  143.     ;;
  144.     *)
  145.     echo "Usage: $0 {start|stop|status|try-restart|restart}"
  146.     exit 1
  147.     ;;
  148. esac
  149. rc_exit
  150.