#! /bin/sh
# /etc/init.d/dumputils
#	Initializes the Linux Kernel Crash Dump system
#

CONFIGDUMP=/usr/sbin/configdump
SAVEDUMP=/usr/sbin/savedump

# If the dumputils executables aren't all present, give up
[ -x ${CONFIGDUMP} ] || exit 1
[ -x ${SAVEDUMP} ] || exit 1

#
# Handle System V init conventions...
#
case $1 in
start | restart)
	# Load configuration
	${CONFIGDUMP} || exit 0

	# Message
	echo "Saving system crash dump (if necessary)..."

	# Save crash dump (if one exists)
	${SAVEDUMP}
	;;

reload | force-reload )
	# Reload configuration
	${CONFIGDUMP} || exit 0
	;;
stop)
	# Prevent crash dumps
	${CONFIGDUMP} -l 0 || exit 0
	;;
*)
	echo "Usage: /etc/init.d/dumputils {start|stop|reload|force-reload|restart}"
        exit 1
	;;
esac

exit 0
