5
# Required-Start: $syslog $local_fs $remote_fs
6
# Required-Stop: $remote_fs
9
# Default-Start: 2 3 4 5
11
# Short-Description: Machine Check Exceptions (MCE) collector & decoder
12
# Description: Machine Check Exceptions are raised by the CPU whenever
13
# it encounters an hardware error. mcelog collects and
14
# decodes Machine Check Exceptions as they happen.
17
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
DAEMON=/usr/sbin/mcelog
20
DESC="Machine Check Exceptions decoder"
21
TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
25
test -x $DAEMON || exit 0
27
if [ ! -r /dev/mcelog ]; then
28
echo "/dev/mcelog not active"
32
[ -r /etc/default/mcelog ] && . /etc/default/mcelog
34
. /lib/lsb/init-functions
41
if start-stop-daemon --stop --test --quiet --exec $DAEMON; then
42
echo "WARNING: mcelog daemon running, not setting up MCE trigger"
46
echo -n "Setting up Machine Check Exceptions trigger..."
47
if [ -e $TRIGGER ]; then
48
echo $DAEMON > $TRIGGER
50
echo " not supported on this machine."
55
echo -n "Running $DESC..."
62
echo -n "Clearing Machine Check Exceptions trigger..."
63
if [ -e $TRIGGER ]; then
66
echo " not supported on this machine."
74
if [ "$(cat $TRIGGER)" = $DAEMON ]; then
75
echo "Machine Check Exceptions collected by mcelog."
78
if [ ! -e $TRIGGER ]; then
79
echo "Machine Check Exceptions not collected by mcelog; trigger mode not supported."
81
echo "Machine Check Exceptions not collected by mcelog."
90
# Check & clear mcelog trigger
91
if [ -e $TRIGGER ] && [ "$(cat $TRIGGER)" = $DAEMON ]; then
95
echo -n "Starting $DESC: "
96
start-stop-daemon --start --quiet --exec $DAEMON -- --daemon $DAEMON_OPTS
102
echo -n "Stopping $DESC: "
103
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
109
echo -n "Restarting $DESC: "
111
# Check & clear mcelog trigger
112
if [ -e $TRIGGER ] && [ "$(cat $TRIGGER)" = $DAEMON ]; then
116
start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
118
start-stop-daemon --start --quiet --exec $DAEMON -- --daemon $DAEMON_OPTS
127
if start-stop-daemon --stop --test --quiet --exec $DAEMON; then
138
if [ "$RUN_MODE" = "trigger" ]; then
145
if [ "$RUN_MODE" = "trigger" ]; then
152
if [ "$RUN_MODE" = "trigger" ]; then
159
if [ "$RUN_MODE" = "trigger" ]; then
160
[ -e $TRIGGER ] && [ "$(cat $TRIGGER)" = $DAEMON ] && $0 restart || exit 0
162
start-stop-daemon --stop --test --quiet --exec $DAEMON \
168
if [ "$RUN_MODE" = "trigger" ]; then
176
echo "Usage: $N {start|stop|restart|force-reload}" >&2