abrt/abrt.init

116 lines
1.7 KiB
Plaintext
Raw Normal View History

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
# 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
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
#
# 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
[ "`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
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
if [ ! -f $LOCK ] && [ ! -f $OLD_LOCK ]; then
2009-09-04 17:55:36 +00:00
echo -n $"Starting abrt daemon: "
daemon $ABRT_BIN
2009-09-04 17:55:36 +00:00
RETVAL=$?
[ $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: "
killproc $ABRT_BIN
2009-03-03 21:09:07 +00:00
RETVAL=$?
[ $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)
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)
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