abrt/abrt.init
Jiří Moskovčák 5939e9b0b1 - spec file fixes rhbz#593670
- updated init script
2010-05-21 13:38:43 +00:00

116 lines
1.7 KiB
Bash

#!/bin/bash
# Starts the abrt daemon
#
# chkconfig: 35 82 16
# description: Daemon to detect crashing apps
# processname: abrtd
### BEGIN INIT INFO
# Provides: abrt
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Stop: 0 1 2 6
# Default-Start: 3 5
# Short-Description: start and stop abrt daemon
# Description: Listen to and dispatch crash events
### 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"
RETVAL=0
#
# Set these variables if you are behind proxy
#
#export http_proxy=
#export https_proxy=
#
# 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 $ABRT_BIN || exit 5
}
start() {
check
# Check if it is already running
if [ ! -f $LOCK ] && [ ! -f $OLD_LOCK ]; then
echo -n $"Starting abrt daemon: "
daemon $ABRT_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCK
echo
fi
return $RETVAL
}
stop() {
check
echo -n $"Stopping abrt daemon: "
killproc $ABRT_BIN
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $LOCK
[ $RETVAL -eq 0 ] && rm -f $OLD_LOCK
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 $LOCK ]; then
restart
fi
# update from older version
if [ -f $OLD_LOCK ]; then
restart
fi
;;
status)
status abrtd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
RETVAL=2
esac
exit $RETVAL