summaryrefslogtreecommitdiff
path: root/contrib/ipmievd.init.redhat
blob: 1c0253db0ff88fad08c3b2de02fb9dd6f015ee28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#
#	/etc/rc.d/init.d/ipmievd
#
#       Based on example sysvinitfiles script
#       Copyright (c) 2000 Red Hat Software, Inc.
#
# chkconfig: 345 99 00
# description: ipmievd daemon to send events to syslog
# processname: ipmievd
# config:      /etc/sysconfig/ipmievd
#
### BEGIN INIT INFO
# Provides:          ipmievd
# Required-Start:    $syslog ipmi
# Should-Start: $time
# Required-Stop:     $syslog ipmi
# Should-Stop: $time
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: ipmievd daemon to send events to syslog
# Description:       Start ipmievd to read events from BMC and
#	             log them to syslog.  Events correspond to hardware faults,
#	             state transitions such as power on and off, and sensor
#	             readings such as temperature, voltage and fan speed that
#	             are abnormal.
### END INIT INFO

IPMIEVD_BIN=/usr/sbin/ipmievd
test -x $IPMIEVD_BIN || { echo "$IPMIEVD_BIN not installed";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }

# Check for existence of needed config file
IPMIEVD_CONFIG=/etc/sysconfig/ipmievd
test -r $IPMIEVD_CONFIG || { echo "$IPMIEVD_CONFIG does not exist";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 6; fi; }

# Read config file
. $IPMIEVD_CONFIG

# Source function library.
. /etc/init.d/functions

start() {
	echo "Starting ipmievd:"
	if [ -f /var/lock/subsys/ipmievd ]; then
		return 0
	fi
	daemon $IPMIEVD_BIN $IPMIEVD_OPTIONS
	ret=$?
	[ $ret -eq 0 ] && touch /var/lock/subsys/ipmievd
	return $ret
}	

stop() {
	echo "Shutting down ipmievd:"
	killproc $IPMIEVD_BIN
	ret=$?
	[ $ret -eq 0 ] && rm -f /var/lock/subsys/ipmievd
	return $ret
}

case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status $IPMIEVD_BIN
	;;
    restart|reload)
    	stop
	start
	;;
    condrestart)
	[ -f /var/lock/subsys/ipmievd ] && restart || :
	;;
    *)
	echo "Usage: ipmievd {start|stop|status|reload|restart|condrestart}"
	exit 1
	;;
esac
exit $?