2000-03-10 14:53:23 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2009-09-14 21:34:56 +04:00
|
|
|
# $NetBSD: savecore,v 1.8 2009/09/14 17:34:56 apb Exp $
|
2000-03-10 14:53:23 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: savecore
|
|
|
|
# REQUIRE: syslogd
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: SERVERS
|
2000-03-10 14:53:23 +03:00
|
|
|
|
2004-08-13 22:08:03 +04:00
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
2000-03-10 14:53:23 +03:00
|
|
|
|
|
|
|
name="savecore"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2000-03-10 14:53:23 +03:00
|
|
|
start_cmd="savecore_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
|
|
|
savecore_start()
|
|
|
|
{
|
|
|
|
# /var/crash should be a directory or a symbolic link
|
|
|
|
# to the crash directory if core dumps are to be saved.
|
|
|
|
#
|
2004-07-15 07:29:55 +04:00
|
|
|
if [ -d "${savecore_dir}/." ]; then
|
2000-03-10 14:53:23 +03:00
|
|
|
echo "Checking for core dump..."
|
2009-09-14 21:34:56 +04:00
|
|
|
if savecore -n; then
|
|
|
|
savecore $rc_flags "${savecore_dir}"
|
|
|
|
fi
|
2000-03-10 14:53:23 +03:00
|
|
|
else
|
2004-07-15 07:29:55 +04:00
|
|
|
warn "No crash dump directory; savecore not run."
|
2000-03-10 14:53:23 +03:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2000-05-13 12:45:06 +04:00
|
|
|
load_rc_config $name
|
2000-03-10 14:53:23 +03:00
|
|
|
run_rc_command "$1"
|