2010-01-12 16:13:00 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2009 by Thomas Renninger <trenn@suse.de>
|
|
|
|
#
|
|
|
|
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: mcelog
|
|
|
|
# Required-Start:
|
|
|
|
# Should-Start: $remote_fs $network $syslog
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Stop: $remote_fs $network $syslog
|
|
|
|
# Default-Start: 2 3 5
|
|
|
|
# Default-Stop:
|
|
|
|
# Short-Description: Machine Check Architecture/Error (MCA/MCE) implementations
|
|
|
|
# Description: Depending on the configuration, the mcelog service will log
|
|
|
|
# HW initiated Machine Check Excpetions or also react on them intelligently
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
. /etc/rc.status
|
|
|
|
#. /etc/sysconfig/mcelog
|
|
|
|
|
|
|
|
# Shell functions sourced from /etc/rc.status:
|
|
|
|
# rc_check check and set local and overall rc status
|
|
|
|
# rc_status check and set local and overall rc status
|
|
|
|
# rc_status -v ditto but be verbose in local rc status
|
|
|
|
# rc_status -v -r ditto and clear the local rc status
|
|
|
|
# rc_failed set local and overall rc status to failed
|
|
|
|
# rc_reset clear local rc status (overall remains)
|
|
|
|
# rc_exit exit appropriate to overall rc status
|
|
|
|
|
|
|
|
# First reset status of this service
|
|
|
|
rc_reset
|
|
|
|
|
|
|
|
mcelog="/usr/sbin/mcelog"
|
2010-02-23 14:04:03 +01:00
|
|
|
mcelog_params=" --daemon "
|
2010-02-23 14:04:04 +01:00
|
|
|
mcedev=/dev/mcelog
|
2010-02-23 14:04:03 +01:00
|
|
|
mcelog_pid="/var/run/mcelog.pid"
|
2010-01-12 16:13:00 +01:00
|
|
|
|
2010-02-23 14:04:03 +01:00
|
|
|
check="checkproc -p ${mcelog_pid} ${mcelog}"
|
|
|
|
kill="killproc -p ${mcelog_pid} ${mcelog}"
|
|
|
|
start="startproc -p ${mcelog_pid} ${mcelog} ${mcelog_params}"
|
2010-01-12 16:13:00 +01:00
|
|
|
|
|
|
|
test_kernel_support()
|
|
|
|
{
|
|
|
|
if [ ! -c ${mcedev} ];then
|
|
|
|
echo -n "$mcedev not found - no kernel or HW support "
|
|
|
|
return 1
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Starting mcelog... "
|
|
|
|
if ! test_kernel_support; then
|
|
|
|
rc_status -u
|
|
|
|
elif ${check};then
|
|
|
|
echo -n "already running"
|
|
|
|
else
|
|
|
|
${start}
|
|
|
|
fi
|
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
echo -n "Shutting down mcelog... "
|
|
|
|
${kill}
|
|
|
|
rc_status -v
|
|
|
|
;;
|
|
|
|
reload|restart)
|
|
|
|
/etc/init.d/mcelog stop
|
|
|
|
/etc/init.d/mcelog start
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
echo -n "Checking for service mcelog... "
|
|
|
|
if ! test_kernel_support; then
|
|
|
|
rc_status -u
|
|
|
|
else
|
|
|
|
${check}
|
|
|
|
rc_status -v
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload|status}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
rc_exit
|