summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/addswap
blob: 8ca3cf83696bae1ea9832bcfbc5d121cb9381956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
#
# Add additional swap files
#
# $FreeBSD$
#

# PROVIDE: addswap
# REQUIRE: FILESYSTEMS
# BEFORE: sysctl
# KEYWORD: nojail

. /etc/rc.subr

name="addswap"
start_cmd="addswap_start"
stop_cmd=":"

addswap_start()
{
	case ${swapfile} in
	[Nn][Oo] | '')
		;;
	*)
		if [ -w "${swapfile}" ]; then
			echo "Adding ${swapfile} as additional swap"
			mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
		fi
		;;
	esac
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud