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 29IPMIEVD_BIN=/usr/sbin/ipmievd 30test -x $IPMIEVD_BIN || { echo "$IPMIEVD_BIN not installed"; 31 if [ "$1" = "stop" ]; then exit 0; 32 else exit 5; fi; } 33 34# Check for existence of needed config file 35IPMIEVD_CONFIG=/etc/sysconfig/ipmievd 36test -r $IPMIEVD_CONFIG || { echo "$IPMIEVD_CONFIG does not exist"; 37 if [ "$1" = "stop" ]; then exit 0; 38 else exit 6; fi; } 39 40# Read config file 41. $IPMIEVD_CONFIG 42 43# Source function library. 44. /etc/init.d/functions 45 46start() { 47 echo "Starting ipmievd:" 48 if [ -f /var/lock/subsys/ipmievd ]; then 49 return 0 50 fi 51 daemon $IPMIEVD_BIN $IPMIEVD_OPTIONS 52 ret=$? 53 [ $ret -eq 0 ] && touch /var/lock/subsys/ipmievd 54 return $ret 55} 56 57stop() { 58 echo "Shutting down ipmievd:" 59 killproc $IPMIEVD_BIN 60 ret=$? 61 [ $ret -eq 0 ] && rm -f /var/lock/subsys/ipmievd 62 return $ret 63} 64 65case "$1" in 66 start) 67 start 68 ;; 69 stop) 70 stop 71 ;; 72 status) 73 status $IPMIEVD_BIN 74 ;; 75 restart|reload) 76 stop 77 start 78 ;; 79 condrestart) 80 [ -f /var/lock/subsys/ipmievd ] && restart || : 81 ;; 82 *) 83 echo "Usage: ipmievd {start|stop|status|reload|restart|condrestart}" 84 exit 1 85 ;; 86esac 87exit $? 88