#!/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
		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
