Run dumpon earlier, split dumpon/ddb from savecore and run savecore later.

This commit is contained in:
jim-p 2011-01-26 12:42:47 -05:00
parent ee4fc984e1
commit e5323cca19
3 changed files with 29 additions and 23 deletions

8
etc/rc
View File

@ -25,6 +25,12 @@ PLATFORM=`/bin/cat /etc/platform`
# Set our current version
version=`/bin/cat /etc/version`
# Setup dumpdev/ddb/savecore"
echo "Configuring crash dumps..."
if [ "$PLATFORM" = "pfSense" ]; then
/etc/rc.dumpon
fi
# Mount memory file system if it exists
echo "Mounting filesystems..."
@ -110,9 +116,9 @@ elif [ "$PLATFORM" = "nanobsd" ] ; then
/bin/rm -rf /var/db/pkg
/bin/ln -s /root/var/db/pkg/ /var/db/pkg
else
/etc/rc.dumpon
SWAPDEVICE=`/bin/cat /etc/fstab | /usr/bin/grep swap | /usr/bin/cut -f1`
/sbin/swapon -a 2>/dev/null >/dev/null
/etc/rc.savecore
fi
if [ "$PLATFORM" = "cdrom" ] ; then

View File

@ -1,7 +1,6 @@
#!/bin/sh
# Based on:
# FreeBSD: src/etc/rc.d/dumpon,v 1.12.2.1.4.1 2010/06/14 02:09:06 kensmith Exp
# FreeBSD: src/etc/rc.d/savecore,v 1.16.2.2.4.1 2010/06/14 02:09:06 kensmith Exp
# dumpon
@ -34,24 +33,3 @@ fi
if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
/sbin/ddb /etc/ddb.conf
fi
# savecore
dumpdev=`/bin/realpath /dev/dumpdev`
dumpdir='/var/crash'
if [ ! -c "${dumpdev}" ]; then
echo "Dump device does not exist. Savecore not run."
exit
fi
if [ ! -d "${dumpdir}" ]; then
echo "Dump directory does not exist. Savecore not run."
exit
fi
if savecore -C "${dumpdir}" "${dumpdev}" >/dev/null; then
savecore ${dumpdir} ${dumpdev}
else
echo 'No core dumps found.'
fi

22
etc/rc.savecore Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
# Based on:
# FreeBSD: src/etc/rc.d/savecore,v 1.16.2.2.4.1 2010/06/14 02:09:06 kensmith Exp
dumpdev=`/bin/realpath /dev/dumpdev`
dumpdir='/var/crash'
if [ ! -c "${dumpdev}" ]; then
echo "Dump device does not exist. Savecore not run."
exit
fi
if [ ! -d "${dumpdir}" ]; then
echo "Dump directory does not exist. Savecore not run."
exit
fi
if savecore -C "${dumpdir}" "${dumpdev}" >/dev/null; then
savecore ${dumpdir} ${dumpdev}
else
echo 'No core dumps found.'
fi