#!/bin/sh

. /etc/init.d/globals

case $1 in
	start)
		if [ -e /var/etc/.coredump ]; then
			read dumpdir < /var/etc/.coredump
			dumpdir=${dumpdir:-/tmp}
			mkdir -p ${dumpdir}

			# unlimit core file size
			ulimit -c unlimited
			# change default core pattern
			echo "${dumpdir}/core.%e.%p.%t" > /proc/sys/kernel/core_pattern

			SHOWINFO "coredumps stored in" $(cat /proc/sys/kernel/core_pattern)
		fi
	;;
	*)
		echo "[${BASENAME}] Usage: $0 {start}"
	;;
esac
