2009-03-03 21:09:07 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Starts the abrt daemon
|
|
|
|
#
|
2009-09-04 17:55:36 +00:00
|
|
|
# chkconfig: 35 82 16
|
2009-03-03 21:09:07 +00:00
|
|
|
# description: Daemon to detect crashing apps
|
2009-09-04 17:55:36 +00:00
|
|
|
# processname: abrtd
|
2009-03-03 21:09:07 +00:00
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: abrt
|
|
|
|
# Required-Start: $syslog $local_fs
|
|
|
|
# Required-Stop: $syslog $local_fs
|
2009-09-04 17:55:36 +00:00
|
|
|
# Default-Stop: 0 1 2 6
|
|
|
|
# Default-Start: 3 5
|
|
|
|
# Short-Description: start and stop abrt daemon
|
2010-05-21 13:38:43 +00:00
|
|
|
# Description: Listen to and dispatch crash events
|
2009-03-03 21:09:07 +00:00
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
2010-05-21 13:38:43 +00:00
|
|
|
ABRT_BIN="/usr/sbin/abrtd"
|
|
|
|
LOCK="/var/lock/subsys/abrtd"
|
|
|
|
OLD_LOCK="/var/lock/subsys/abrt"
|
2009-03-03 21:09:07 +00:00
|
|
|
RETVAL=0
|
|
|
|
|
2010-05-21 13:38:43 +00:00
|
|
|
#
|
|
|
|
# Set these variables if you are behind proxy
|
|
|
|
#
|
|
|
|
#export http_proxy=
|
|
|
|
#export https_proxy=
|
|
|
|
|
2009-03-03 21:09:07 +00:00
|
|
|
#
|
|
|
|
# See how we were called.
|
|
|
|
#
|
|
|
|
|
|
|
|
check() {
|
|
|
|
# Check that we're a privileged user
|
2010-05-21 13:38:43 +00:00
|
|
|
[ "`id -u`" = 0 ] || exit 4
|
2009-09-04 17:55:36 +00:00
|
|
|
|
2009-03-03 21:09:07 +00:00
|
|
|
# Check if abrt is executable
|
2010-05-21 13:38:43 +00:00
|
|
|
test -x $ABRT_BIN || exit 5
|
2009-03-03 21:09:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
|
|
|
|
check
|
2009-09-04 17:55:36 +00:00
|
|
|
|
2009-03-03 21:09:07 +00:00
|
|
|
# Check if it is already running
|
2010-05-21 13:38:43 +00:00
|
|
|
if [ ! -f $LOCK ] && [ ! -f $OLD_LOCK ]; then
|
2009-09-04 17:55:36 +00:00
|
|
|
echo -n $"Starting abrt daemon: "
|
2010-05-21 13:38:43 +00:00
|
|
|
daemon $ABRT_BIN
|
2009-09-04 17:55:36 +00:00
|
|
|
RETVAL=$?
|
2010-05-21 13:38:43 +00:00
|
|
|
[ $RETVAL -eq 0 ] && touch $LOCK
|
2009-09-04 17:55:36 +00:00
|
|
|
echo
|
2009-03-03 21:09:07 +00:00
|
|
|
fi
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
|
|
|
|
check
|
2009-09-04 17:55:36 +00:00
|
|
|
|
2009-03-03 21:09:07 +00:00
|
|
|
echo -n $"Stopping abrt daemon: "
|
2010-05-21 13:38:43 +00:00
|
|
|
killproc $ABRT_BIN
|
2009-03-03 21:09:07 +00:00
|
|
|
RETVAL=$?
|
2010-05-21 13:38:43 +00:00
|
|
|
[ $RETVAL -eq 0 ] && rm -f $LOCK
|
|
|
|
[ $RETVAL -eq 0 ] && rm -f $OLD_LOCK
|
2009-03-03 21:09:07 +00:00
|
|
|
echo
|
2009-09-04 17:55:36 +00:00
|
|
|
return $RETVAL
|
2009-03-03 21:09:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
2009-09-04 17:55:36 +00:00
|
|
|
}
|
2009-03-03 21:09:07 +00:00
|
|
|
|
|
|
|
reload() {
|
|
|
|
restart
|
2009-09-04 17:55:36 +00:00
|
|
|
}
|
2009-03-03 21:09:07 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
reload
|
|
|
|
;;
|
|
|
|
force-reload)
|
|
|
|
echo "$0: Unimplemented feature."
|
|
|
|
RETVAL=3
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
condrestart)
|
2010-05-21 13:38:43 +00:00
|
|
|
if [ -f $LOCK ]; then
|
|
|
|
restart
|
|
|
|
fi
|
|
|
|
# update from older version
|
|
|
|
if [ -f $OLD_LOCK ]; then
|
|
|
|
restart
|
2009-03-03 21:09:07 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
status)
|
2010-05-21 13:38:43 +00:00
|
|
|
status abrtd
|
2009-03-03 21:09:07 +00:00
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
|
|
|
|
RETVAL=2
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|