dumpon revision 153298
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/dumpon 153298 2005-12-10 20:21:46Z dougb $ 4# 5 6# PROVIDE: dumpon 7# BEFORE: disks savecore initrandom 8# KEYWORD: nojail 9 10. /etc/rc.subr 11 12name="dumpon" 13start_cmd="dumpon_start" 14stop_cmd="dumpon_stop" 15 16dumpon_try() 17{ 18 if /sbin/dumpon -v "${1}" ; then 19 # Make a symlink in devfs for savecore 20 ln -fs "${1}" /dev/dumpdev 21 return 0 22 fi 23 return 1 24} 25 26dumpon_start() 27{ 28 # Enable dumpdev so that savecore can see it. Enable it 29 # early so a crash early in the boot process can be caught. 30 # 31 case ${dumpdev} in 32 [Nn][Oo] | '') 33 ;; 34 [Aa][Uu][Tt][Oo]) 35 dev=$(/bin/kenv -q dumpdev) 36 if [ -n "${dev}" ] ; then 37 dumpon_try "${dev}" 38 return $? 39 fi 40 while read dev mp type more ; do 41 [ "${type}" = "swap" ] || continue 42 [ -c "${dev}" ] || continue 43 dumpon_try "${dev}" 2>/dev/null && return 0 44 done </etc/fstab 45 echo "No suitable dump device was found." 1>&2 46 return 1 47 ;; 48 *) 49 dumpon_try "${dumpdev}" 50 ;; 51 esac 52} 53 54dumpon_stop() 55{ 56 case ${dumpdev} in 57 [Nn][Oo] | '') 58 ;; 59 *) 60 rm -f /dev/dumpdev 61 /sbin/dumpon -v off 62 ;; 63 esac 64} 65 66load_rc_config $name 67run_rc_command "$1" 68