usched: Fix the returned CPU affinity make by smp_active_mask.
[dragonfly.git] / etc / rc.d / savecore
blob6b9920d756677b0f0aee531f1f43c6b45d11dbfe
1 #!/bin/sh
3 # $NetBSD: savecore,v 1.5 2002/03/22 04:34:00 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/savecore,v 1.3 2002/09/06 16:18:05 gordon Exp $
5 # $DragonFly: src/etc/rc.d/savecore,v 1.6 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: savecore
9 # REQUIRE: syslogd
10 # BEFORE: SERVERS
12 . /etc/rc.subr
14 name="savecore"
15 start_cmd="savecore_start"
16 start_precmd="savecore_prestart"
17 stop_cmd=":"
19 case ${OSTYPE} in
20 NetBSD)
21 rcvar=$name
23 esac
25 savecore_prestart()
27 # ${DUMPDIR} should be a directory or a symbolic link
28 # to the crash directory if core dumps are to be saved.
30 DUMPDIR="${dumpdir:-/var/crash}"
32 # Quit if we have no dump device
33 case ${dumpdev} in
34 [Nn][Oo] | '')
35 debug 'No dump device. Quitting.'
36 dumpdev=
37 return 0
39 esac
40 # If there is no crash directory set it now
41 case ${dumpdir} in
42 '')
43 dumpdir='/var/crash'
45 [Nn][Oo])
46 dumpdir='NO'
48 esac
49 if [ ! -e "${dumpdev}" -o ! -d "${dumpdir}" ]; then
50 warn "Wrong dump device or directory. Savecore not run."
51 dumpdev=
52 return 0
54 return 0
57 savecore_start()
59 if [ X$dumpdev != X ]; then
60 if savecore -C "${DUMPDIR}" "${dumpdev}" > /dev/null; then
61 savecore ${savecore_flags} ${DUMPDIR} ${dumpdev}
62 if checkyesno crashinfo_enable; then
63 ${crashinfo_program} -d ${DUMPDIR}
65 else
66 echo 'No core dumps found.'
68 return ${RC_CONFIGURED}
72 load_rc_config $name
73 run_rc_command "$1"