File: mcelog.init

package info (click to toggle)
mcelog 104-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 996 kB
  • ctags: 1,508
  • sloc: ansic: 7,739; sh: 481; makefile: 87
file content (97 lines) | stat: -rwxr-xr-x 2,049 bytes parent folder | download | duplicates (4)
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
#!/bin/sh
# 
# Startup script for mcelog
# 
# This should be customized for distribution standards
# (using rc_status etc.)
# The paths are hardcoded and are not automatically adjusted
# for different prefix
#
### BEGIN INIT INFO
# Provides:		mcelog 
# Default-Start:	3 5
# Default-Stop:		0 1 2 6
# Short-Description:	mcelog hardware error logging
# Description:          Start the mcelog hardware error logging. 
#                       This logs and handles CPU hardware errors on x86 systems.
### END INIT INFO

# put this is sysconfig

# mcelog mode
# valid values: daemon, trigger, cron
# Recommended value daemon
MCELOG_MODE=daemon

# additional options to pass to the daemon
# this only works in daemon mode
# see the manpage for details. settings can be also
# set in /etc/mcelog.conf
MCELOG_OPTIONS=""

# private settings
MCELOG=${MCELOG:-/usr/sbin/mcelog}
TRIGGER=/sys/devices/system/machinecheck/machinecheck0/trigger
[ ! -x $MCELOG ] && ( echo "mcelog not found" ; exit 1 )
[ ! -r /dev/mcelog ] && ( echo "/dev/mcelog not active" ; exit 0 )

case "$MCELOG_MODE" in
daemon)
	;;
trigger)
	;;
cron)
	echo "mcelog not started"
	exit 0
	;;
*)
	echo "Unknown mcelog mode $MCELOG_MODE. Valid daemon/trigger/cron"
	exit 1
esac

case "$1" in
start)
	if [ "$MCELOG_MODE" = "daemon" ] ; then
		echo "Starting mcelog daemon"
		startproc $MCELOG --daemon $MCELOG_OPTIONS
	elif [ -f "$TRIGGER" ] ; then
		echo $MCELOG > "$TRIGGER"
	else
		echo No machine check capability
	fi
	;;
stop)
	if [ "$MCELOG_MODE" = "daemon" ] ; then
		echo "Stopping mcelog"
		killproc -TERM $MCELOG
	elif [ "$MCELOG_MODE" = "trigger" -a -f "$TRIGGER" ]; then 
		echo "" > "$TRIGGER"
	else
		echo mcelog not running
	fi
	;;
try-restart)
	$0 status > /dev/null && $0 restart
	;;
restart)
	$0 stop
	$0 start
	;;
reload)
	$0 try-restart
	;;
force-reload)
	$0 try-restart
	;;
status)
	if [ "$MCELOG_MODE" = "daemon" ] ; then
		echo "Checking for mcelog"
		checkproc $MCELOG
	fi
	;;
*)
	echo "Usage: $0 {start|stop|try-restart|restart|status|force-reload|reload}"
	exit 1
esac