PageRenderTime 19ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/rc2.d/S20kerneloops

http://github.com/brinkman83/bashrc
Shell | 94 lines | 56 code | 15 blank | 23 comment | 4 complexity | 4295e0b4136f989b022b3c2475866519 MD5 | raw file
 1#!/bin/sh
 2#
 3# kerneloops
 4#
 5# chkconfig:   345 90 88
 6# description: A tool that collects and submits kernel crash \
 7# signatures to the kerneloops.org website for use by the Linux \
 8# kernel developers.
 9# processname: kerneloops
10# config:      /etc/kerneloops.conf
11#
12### BEGIN INIT INFO
13# Provides: kerneloops
14# Default-Start: 2 3 4 5
15# Default-Stop: 1
16# Required-Start: $local_fs $remote_fs $named $network $time $syslog
17# Required-Stop: $local_fs $remote_fs $syslog
18# Short-Description: Tool to automatically collect and submit kernel crash signatures
19# Description: A tool that collects and submits kernel crash
20#   signatures to the kerneloops.org website for use by the Linux
21#   kernel developers.
22### END INIT INFO
23
24# Source function library.
25. /lib/lsb/init-functions
26
27
28exec="/usr/sbin/kerneloops"
29prog=$(basename $exec)
30service="Kernel Oops catching service"
31pidfile=/var/run/$prog.pid
32sconf="/etc/kerneloops.conf"
33enabled=1
34
35[ -x "$exec" ] || exit 0
36
37[ -e /etc/default/$prog ] && . /etc/default/$prog
38
39[ "$enabled" = "1" ] || exit 0
40
41start() {
42	log_daemon_msg "Starting $service" "$prog"
43	start-stop-daemon --start --quiet --oknodo --chuid kernoops:adm --pidfile $pidfile --exec $exec
44	retval=$?
45	pidof -s kerneloops > $pidfile
46	log_end_msg "$retval"
47	return $retval
48}
49
50stop() {
51	log_daemon_msg "Stopping $service" "$prog"
52	start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile
53	retval=$?
54	rm -f $pidfile
55	log_end_msg "$retval"
56	return $retval
57}
58
59restart() {
60	stop
61	start
62}
63
64reload() {
65	restart
66}
67
68force_reload() {
69	restart
70}
71
72fdr_status() {
73	status_of_proc -p $pidfile $prog "$service"
74}
75
76
77case "$1" in
78	start|stop|restart|reload)
79  		$1
80		;;
81	force-reload)
82		force_reload
83		;;
84	status)
85		fdr_status
86		;;
87	condrestart|try-restart)
88		pidof kerneloops >/dev/null || restart
89		;;
90	*)
91		echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
92		exit 1
93esac
94