3 # mcelog mcelog hardware error logging
7 # description: Start the mcelog hardware error logging. \
8 # This logs and handles CPU hardware errors on x86 systems.
14 # Source function library
15 . /etc/rc.d/init.d/functions
18 # valid values: daemon, trigger, cron
19 # Recommended value daemon
22 # additional options to pass to the daemon
23 # this only works in daemon mode
24 # see the manpage for details. settings can be also
25 # set in /etc/mcelog/mcelog.conf
28 # Get service config - may override defaults
29 [ -f /etc/sysconfig/mcelog ] && . /etc/sysconfig/mcelog
32 # sysfs "trigger" file present in each cpu dir is really shared for all cpus
33 TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
36 # must return non-zero if check failed
37 # output is discarded if checkconfig is ran without details
39 if [ ! -r /dev/mcelog ]; then
40 nls "%s not active" /dev/mcelog
44 case "$MCELOG_MODE" in
48 if [ ! -f "$TRIGGER" ] ; then
49 nls "No machine check capability"
54 nls "mcelog not started in cron mode"
58 nls "Unknown mcelog mode %s. Valid are: daemon/trigger/cron" $MCELOG_MODE
65 # wrapper for configtest
69 if [ $details = 1 ]; then
70 # run config test and display report (status action)
71 show "Checking %s configuration" "MCE Log"; busy
73 out=$(configtest 2>&1)
75 if [ $RETVAL = 0 ]; then
80 [ "$out" ] && echo >&2 "$out"
82 # run config test and abort with nice message if failed
83 # (for actions checking status before action).
84 configtest >/dev/null 2>&1
86 if [ $RETVAL != 0 ]; then
87 show "Checking %s configuration" "MCE Log"; fail
88 nls 'Configuration test failed. See details with %s "checkconfig"' $0
95 # Check if the service is already running?
96 if [ -f /var/lock/subsys/mcelog ]; then
97 msg_already_running "MCE Log"
103 case "$MCELOG_MODE" in
105 msg_starting "MCE Log"
106 daemon /usr/sbin/mcelog --daemon $MCELOG_OPTIONS
108 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mcelog
111 echo $MCELOG > "$TRIGGER"
112 touch /var/lock/subsys/mcelog
118 if [ ! -f /var/lock/subsys/mcelog ]; then
119 msg_not_running "MCE Log"
123 case "$MCELOG_MODE" in
126 msg_stopping "MCE Log"
127 killproc mcelog -TERM
128 rm -f /var/lock/subsys/mcelog
132 rm -f /var/lock/subsys/mcelog
138 if [ ! -f /var/lock/subsys/mcelog ]; then
139 msg_not_running "MCE Log"
150 case "$MCELOG_MODE" in
159 # See how we were called.
178 checkconfig|configtest)
185 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"