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