dumpon revision 150103
1153187Spjd#!/bin/sh 2153187Spjd# 3153187Spjd# $FreeBSD: head/etc/rc.d/dumpon 150103 2005-09-13 19:07:02Z rwatson $ 4153187Spjd# 5153187Spjd 6153187Spjd# PROVIDE: dumpon 7153187Spjd# REQUIRE: rcconf 8153187Spjd# BEFORE: disks savecore initrandom 9153187Spjd# KEYWORD: nojail 10153187Spjd 11293438Sngie. /etc/rc.subr 12293438Sngie 13153187Spjdname="dumpon" 14293438Sngiestart_cmd="dumpon_start" 15293438Sngiestop_cmd="dumpon_stop" 16293438Sngie 17293438Sngiedumpon_try() 18153187Spjd{ 19153187Spjd if /sbin/dumpon -v "${1}" ; then 20293438Sngie # Make a symlink in devfs for savecore 21153187Spjd ln -fs "${1}" /dev/dumpdev 22153187Spjd return 0 23153187Spjd fi 24153187Spjd return 1 25153187Spjd} 26153187Spjd 27153187Spjddumpon_start() 28153187Spjd{ 29153187Spjd # Enable dumpdev so that savecore can see it. Enable it 30153187Spjd # early so a crash early in the boot process can be caught. 31153187Spjd # 32153187Spjd case ${dumpdev} in 33153187Spjd [Nn][Oo] | '') 34153187Spjd ;; 35153187Spjd [Aa][Uu][Tt][Oo]) 36153187Spjd dev=$(/bin/kenv -q dumpdev) 37 if [ -n "${dev}" ] ; then 38 dumpon_try "${dev}" 39 return $? 40 fi 41 while read dev mp type more ; do 42 [ "${type}" = "swap" ] || continue 43 [ -c "${dev}" ] || continue 44 dumpon_try "${dev}" 2>/dev/null && return 0 45 done </etc/fstab 46 echo "No suitable dump device was found." 1>&2 47 return 1 48 ;; 49 *) 50 dumpon_try "${dumpdev}" 51 ;; 52 esac 53} 54 55dumpon_stop() 56{ 57 case ${dumpdev} in 58 [Nn][Oo] | '') 59 ;; 60 *) 61 rm -f /dev/dumpdev 62 /sbin/dumpon -v off 63 ;; 64 esac 65} 66 67load_rc_config $name 68run_rc_command "$1" 69