summaryrefslogtreecommitdiff
path: root/kerneloops.init
blob: 5f07b453ef61b74b07d36a46cd214c03e8e6a963 (plain)
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
#!/bin/sh
#
# chkconfig:   345 90 88
# description: A tool that collects and submits kernel crash \
# signatures to the kerneloops.org website for use by the Linux \
# kernel developers.
# processname: kerneloops
# config:      /etc/kerneloops.conf

# Source function library.
. /etc/rc.d/init.d/functions

sconf="/etc/kerneloops.conf"

# Source config
if [ -f /etc/sysconfig/kerneloops ] ; then
	. /etc/sysconfig/kerneloops
fi

start() {
	if [ ! -f /var/lock/subsys/kerneloops ]; then
		msg_starting kerneloops
		daemon /usr/sbin/kerneloops --file /var/log/kernel
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/kerneloops
	else
		msg_already_running kerneloops
	fi
}

stop() {
	if [ -f /var/lock/subsys/kerneloops ]; then
		msg_stopping kerneloops
		killproc kerneloops
		rm -f /var/lock/subsys/kerneloops
	else
		msg_not_running kerneloops
	fi
}

condrestart() {
	if [ -f /var/lock/subsys/kerneloops ]; then
		stop
		start
	else
		msg_not_running kerneloops
		RETVAL=$1
	fi
}

RETVAL=0
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart)
	stop
	start
	;;
  try-restart)
	condrestart 0
	;;
  force-reload)
	condrestart 7
	;;
  status)
	status kerneloops
	;;
  *)
	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
	exit 3
esac

exit $RETVAL