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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
#! /bin/sh
#
# System startup script for opal_errd daemon
#
# Copyright (C) 2014 IBM Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# Description: Starts opal_errd daemon to retrieve platform errors
# and performs error log analysis.
# Return values:
# 0 Success
# 1 Unspecified error
# 2 Invalid argument(s)
# 3 Unimplemented feature
# 4 Insufficient privileges
# 5 Daemon not installed
# 6 Daemon not configured
# 7 Daemon not running
# 8 - 199 Reserved
### BEGIN INIT INFO
# Provides: opal_errd
# Required-Start: $local_fs $syslog $time
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 4 6
# Short-Description: Daemon to retrieve platform errors/events
# Description: Starts opal_errd daemon to retrieve platform errors,
# parse the error and log to syslog.
### END INIT INFO
# Command path
OE_BIN=/usr/sbin/opal_errd
test -x $OE_BIN || exit 5
if [ ! -e "/sys/firmware/opal/elog" ]; then
echo "opal_errd daemon is not supported on this platform"
exit 0
fi
if [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
INSSERV=1
else
. /etc/rc.d/init.d/functions
INSSERV=0
fi
opal_errd_start()
{
if [ $INSSERV -eq 1 ]; then
startproc $OE_BIN
rc_status -v
else
daemon $OE_BIN
pid=`pidof opal_errd`
if [ -n "$pid" ]; then
echo $pid > /var/run/opal_errd.pid
touch /var/lock/subsys/opal_errd
fi
fi
}
opal_errd_stop()
{
if [ $INSSERV -eq 1 ]; then
killproc -TERM $OE_BIN
rc_status -v
else
killproc opal_errd -TERM
rm -f /var/lock/subsys/opal_errd
rm -f /var/run/opal_errd.pid
echo
fi
}
opal_errd_status()
{
if [ $INSSERV -eq 1 ]; then
checkproc $OE_BIN
rc_status -v
else
status opal_errd
fi
}
opal_errd_reload()
{
pid=`pidof opal_errd`
if [ -n "$pid" ]; then
kill -HUP $pid
fi
}
case "$1" in
start)
echo -n "Starting opal_errd daemon: "
opal_errd_start
;;
stop)
echo -n "Stopping opal_errd daemon: "
opal_errd_stop
;;
restart)
# Stop and restart the service
echo -n "Restarting opal_errd daemon: "
opal_errd_stop
opal_errd_start
if [ $INSSERV -eq 1 ]; then
rc_status
fi
;;
reload)
# Reload the config
echo -n "Reload opal_errd daemon: "
opal_errd_reload
;;
status)
opal_errd_status
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload}"
exit 1
;;
esac
if [ $INSSERV -eq 1 ]; then
rc_exit
else
exit 0
fi
|