#!/bin/bash # Starts the crash-catcher daemon # # chkconfig: - 82 16 # description: Daemon to detect crashing apps # processname: crash-catcher ### BEGIN INIT INFO # Provides: crash-catcher # 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 crash-catcher is executable test -x /usr/sbin/crash-catcher || exit 5 } start() { check # Check if it is already running if [ ! -f /var/lock/subsys/crash-catcher ]; then echo -n $"Starting crash-catcher daemon: " daemon /usr/sbin/crash-catcher RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crash-catcher echo fi return $RETVAL } stop() { check echo -n $"Stopping crash-catcher daemon: " killproc /usr/sbin/crash-catcher RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/crash-catcher 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/crash-catcher ]; then restart fi ;; status) status crash-catcher RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}" RETVAL=2 esac exit $RETVAL