kernel - Make certain sysctl's unlocked
[dragonfly.git] / etc / rc.d / swap1
blob0f123696ca59b4459b87d8a6df3808ebbd1b0e00
1 #!/bin/sh
3 # $NetBSD: swap1,v 1.8 2002/03/24 15:52:41 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/swap1,v 1.3 2002/09/06 16:18:05 gordon Exp $
5 # $DragonFly: src/etc/rc.d/swap1,v 1.5 2005/11/19 21:47:32 swildner Exp $
8 # PROVIDE: localswap
9 # REQUIRE: savecore
10 # BEFORE: SERVERS
11 # KEYWORD: shutdown
13 . /etc/rc.subr
15 name="swap1"
16 start_cmd='df_swap1_start'
17 stop_cmd=':'
19 # Add all block-type swap devices; these might be necessary
20 # during disk checks.
22 swap1_start()
24 if ! checkyesno no_swap; then
25 swapctl -A -t blk
29 # Remove all block-type swap devices
31 swap1_stop()
33 if checkyesno swapoff || [ -n "$rc_force" ]; then
34 echo "Removing block-type swap devices"
35 swapctl -U -t blk
39 df_swap1_start()
41 if [ `${SYSCTL_N} vm.swap_enabled` = 0 ]; then
42 return ${RC_CONFIGURED}
43 else
44 swapon -a && return ${RC_CONFIGURED}
46 return ${RC_FAILED}
50 load_rc_config swap
51 run_rc_command "$1"