1#! /bin/sh 2### BEGIN INIT INFO 3# Provides: ipmievd 4# Required-Start: $local_fs $remote_fs $syslog 5# Required-Stop: $local_fs $remote_fs $syslog 6# Default-Start: 2 3 4 5 7# Default-Stop: S 0 1 6 8# Short-Description: IPMI event daemon 9# Description: ipmievd is a daemon which will listen for events 10# from the BMC that are being sent to the SEL and 11# also log those messages to syslog. 12### END INIT INFO 13# 14# Author: Elmar Hoffmann <elho@elho.net> 15# Licence: This script is public domain using the same 16# licence as ipmitool itself. 17# Modified by: Petter Reinholdtsen 18 19set -e 20 21PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 22DESC="IPMI event daemon" 23NAME=ipmievd 24DAEMON=/usr/sbin/$NAME 25PIDFILE=/var/run/$NAME.pid 26SCRIPTNAME=/etc/init.d/$NAME 27 28# Gracefully exit if the package has been removed. 29test -x $DAEMON || exit 0 30 31. /lib/lsb/init-functions 32. /etc/default/rcS 33 34# Options used by ipmievd. 35# 36# "open" uses the asynchronous event notification from the OpenIPMI 37# kernel driver, "sel" uses active polling of the contents of the SEL 38# for new events. 39# 40# Need to force 'daemon' mode, to make sure messages are sent to 41# syslog and the program forks into the background. 42# 43# Se ipmievd(8) for more info. 44IPMIEVD_OPTIONS="open daemon" 45 46# Read config file if it is present. 47[ -f /etc/default/$NAME ] && . /etc/default/$NAME 48 49# 50# Function that starts the daemon/service. 51# 52d_start() { 53 start-stop-daemon --start --quiet --exec $DAEMON -- $IPMIEVD_OPTIONS 54} 55 56# 57# Function that stops the daemon/service. 58# 59d_stop() { 60 start-stop-daemon --stop --quiet --name $NAME --exec $DAEMON 61} 62 63CODE=0 64 65case "$1" in 66 start) 67 [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME" 68 d_start || CODE=$? 69 [ "$VERBOSE" != no ] && log_end_msg $CODE 70 exit $CODE 71 ;; 72 stop) 73 log_begin_msg "Stopping $DESC" "$NAME" 74 d_stop || CODE=$? 75 log_end_msg $CODE 76 exit $CODE 77 ;; 78 restart|force-reload) 79 log_begin_msg "Restarting $DESC" "$NAME" 80 d_stop || true 81 sleep 1 82 d_start || CODE=$? 83 log_end_msg $CODE 84 exit $CODE 85 ;; 86 *) 87 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 88 exit 1 89 ;; 90esac 91 92exit 0 93