Blob Blame History Raw
#!/bin/bash
# Starts the abrt daemon
#
# chkconfig: - 82 16
# description: Daemon to detect crashing apps
# processname: abrt
### BEGIN INIT INFO
# Provides: abrt
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop crash-carcher daemon
# Description: Listen and dispatch crash events
### END INIT INFO

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

RETVAL=0

#
# See how we were called.
#

check() {
	# Check that we're a privileged user
	[ `id -u` = 0 ] || exit 4
	
	# Check if abrt is executable
	test -x /usr/sbin/abrt || exit 5
}

start() {

	check
	
	# Check if it is already running
	if [ ! -f /var/lock/subsys/abrt ]; then
		echo -n $"Starting abrt daemon: "	
	    daemon /usr/sbin/abrt
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/abrt
	    echo
	fi
	return $RETVAL
}

stop() {

	check
	
	echo -n $"Stopping abrt daemon: "
	killproc /usr/sbin/abrt
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/abrt
	echo
    return $RETVAL
}


restart() {
	stop
	start
}	

reload() {
	restart
}	

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload)
	reload
	;;
force-reload)
	echo "$0: Unimplemented feature."
	RETVAL=3
	;;
restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/abrt ]; then
	    restart
	fi
	;;
status)
	status abrt
	RETVAL=$?
	;;
*)
	echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
	RETVAL=2
esac

exit $RETVAL