Home | History | Annotate | Line # | Download | only in rc.d
savecore revision 1.8
      1  1.1    lukem #!/bin/sh
      2  1.1    lukem #
      3  1.8      apb # $NetBSD: savecore,v 1.8 2009/09/14 17:34:56 apb Exp $
      4  1.1    lukem #
      5  1.1    lukem 
      6  1.1    lukem # PROVIDE: savecore
      7  1.1    lukem # REQUIRE: syslogd
      8  1.5  thorpej # BEFORE:  SERVERS
      9  1.1    lukem 
     10  1.7  mycroft $_rc_subr_loaded . /etc/rc.subr
     11  1.1    lukem 
     12  1.1    lukem name="savecore"
     13  1.3    lukem rcvar=$name
     14  1.1    lukem start_cmd="savecore_start"
     15  1.1    lukem stop_cmd=":"
     16  1.1    lukem 
     17  1.1    lukem savecore_start()
     18  1.1    lukem {
     19  1.1    lukem 	#	/var/crash should be a directory or a symbolic link
     20  1.1    lukem 	#	to the crash directory if core dumps are to be saved.
     21  1.1    lukem 	#
     22  1.6   atatat 	if [ -d "${savecore_dir}/." ]; then
     23  1.1    lukem 		echo "Checking for core dump..."
     24  1.8      apb 		if savecore -n; then
     25  1.8      apb 			savecore $rc_flags "${savecore_dir}"
     26  1.8      apb 		fi
     27  1.1    lukem 	else
     28  1.6   atatat 		warn "No crash dump directory; savecore not run."
     29  1.1    lukem 	fi
     30  1.1    lukem }
     31  1.1    lukem 
     32  1.2    lukem load_rc_config $name
     33  1.1    lukem run_rc_command "$1"
     34