dumpon revision 135525
198184Sgordon#!/bin/sh 298184Sgordon# 398184Sgordon# $FreeBSD: head/etc/rc.d/dumpon 135525 2004-09-20 17:48:45Z des $ 498184Sgordon# 598184Sgordon 698184Sgordon# PROVIDE: dumpon 798184Sgordon# REQUIRE: initrandom 898184Sgordon# BEFORE: disks savecore 9126744Spjd# KEYWORD: FreeBSD nojail 1098184Sgordon 1198184Sgordon. /etc/rc.subr 1298184Sgordon 1398184Sgordonname="dumpon" 1498184Sgordonstart_cmd="dumpon_start" 15125341Spjdstop_cmd="dumpon_stop" 1698184Sgordon 1798184Sgordondumpon_start() 1898184Sgordon{ 1998184Sgordon # Enable dumpdev so that savecore can see it. Enable it 2098184Sgordon # early so a crash early in the boot process can be caught. 2198184Sgordon # 2298184Sgordon case ${dumpdev} in 2398184Sgordon [Nn][Oo] | '') 2498184Sgordon ;; 25135525Sdes [Aa][Uu][Tt][Oo]) 26135525Sdes memsize=$((`/sbin/sysctl -n hw.physmem` / 1024)) 27135525Sdes while read dev mp type more ; do 28135525Sdes [ "${type}" = "swap" ] || continue 29135525Sdes [ -c "${dev}" ] || continue 30135525Sdes /sbin/dumpon -v "${dev}" 2>/dev/null && return 0 31135525Sdes done </etc/fstab 32135525Sdes echo "No suitable dump device was found." 1>&2 33135525Sdes return 1 34135525Sdes ;; 3598184Sgordon *) 3698184Sgordon /sbin/dumpon -v ${dumpdev} 3798184Sgordon ;; 3898184Sgordon esac 3998184Sgordon} 4098184Sgordon 41125341Spjddumpon_stop() 42125341Spjd{ 43125341Spjd case ${dumpdev} in 44125341Spjd [Nn][Oo] | '') 45125341Spjd ;; 46125341Spjd *) 47125341Spjd /sbin/dumpon -v off 48125341Spjd ;; 49125341Spjd esac 50125341Spjd} 51125341Spjd 5298184Sgordonload_rc_config $name 5398184Sgordonrun_rc_command "$1" 54