summaryrefslogtreecommitdiffstats
path: root/etc/rc.savecore
blob: 868533027fb949c2f1b0a3a4bf4c6398a9e79d43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
OpenPOWER on IntegriCloud