ipmievd.init.redhat 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. #
  3. # /etc/rc.d/init.d/ipmievd
  4. #
  5. # Based on example sysvinitfiles script
  6. # Copyright (c) 2000 Red Hat Software, Inc.
  7. #
  8. # chkconfig: 345 99 00
  9. # description: ipmievd daemon to send events to syslog
  10. # processname: ipmievd
  11. # config: /etc/sysconfig/ipmievd
  12. #
  13. ### BEGIN INIT INFO
  14. # Provides: ipmievd
  15. # Required-Start: $syslog ipmi
  16. # Should-Start: $time
  17. # Required-Stop: $syslog ipmi
  18. # Should-Stop: $time
  19. # Default-Start: 3 4 5
  20. # Default-Stop: 0 1 2 6
  21. # Short-Description: ipmievd daemon to send events to syslog
  22. # Description: Start ipmievd to read events from BMC and
  23. # log them to syslog. Events correspond to hardware faults,
  24. # state transitions such as power on and off, and sensor
  25. # readings such as temperature, voltage and fan speed that
  26. # are abnormal.
  27. ### END INIT INFO
  28. IPMIEVD_BIN=/usr/sbin/ipmievd
  29. test -x $IPMIEVD_BIN || { echo "$IPMIEVD_BIN not installed";
  30. if [ "$1" = "stop" ]; then exit 0;
  31. else exit 5; fi; }
  32. # Check for existence of needed config file
  33. IPMIEVD_CONFIG=/etc/sysconfig/ipmievd
  34. test -r $IPMIEVD_CONFIG || { echo "$IPMIEVD_CONFIG does not exist";
  35. if [ "$1" = "stop" ]; then exit 0;
  36. else exit 6; fi; }
  37. # Read config file
  38. . $IPMIEVD_CONFIG
  39. # Source function library.
  40. . /etc/init.d/functions
  41. start() {
  42. echo "Starting ipmievd:"
  43. if [ -f /var/lock/subsys/ipmievd ]; then
  44. return 0
  45. fi
  46. daemon $IPMIEVD_BIN $IPMIEVD_OPTIONS
  47. ret=$?
  48. [ $ret -eq 0 ] && touch /var/lock/subsys/ipmievd
  49. return $ret
  50. }
  51. stop() {
  52. echo "Shutting down ipmievd:"
  53. killproc $IPMIEVD_BIN
  54. ret=$?
  55. [ $ret -eq 0 ] && rm -f /var/lock/subsys/ipmievd
  56. return $ret
  57. }
  58. case "$1" in
  59. start)
  60. start
  61. ;;
  62. stop)
  63. stop
  64. ;;
  65. status)
  66. status $IPMIEVD_BIN
  67. ;;
  68. restart|reload)
  69. stop
  70. start
  71. ;;
  72. condrestart)
  73. [ -f /var/lock/subsys/ipmievd ] && restart || :
  74. ;;
  75. *)
  76. echo "Usage: ipmievd {start|stop|status|reload|restart|condrestart}"
  77. exit 1
  78. ;;
  79. esac
  80. exit $?