Sync usage with man page.
[netbsd-mini2440.git] / etc / rc.d / swap2
blobbbe4cbb69591e59869362c3625b95e64fdf992e6
1 #!/bin/sh
3 # $NetBSD: swap2,v 1.7 2004/08/13 18:08:03 mycroft Exp $
6 # PROVIDE: nonlocalswap
7 # REQUIRE: mountcritremote
8 # BEFORE: DAEMON
10 $_rc_subr_loaded . /etc/rc.subr
12 name="swap2"
13 start_cmd="swap2_start"
15 swap2_start()
17 # "Critical" file systems are now mounted. Go ahead and swap
18 # to files now, since they will be residing in the critical file
19 # systems (or, at least, they should be...).
21 # Treat exit status 2 from swapctl(8) as successful; it means
22 # "no error, but no suitable swap devices were configured".
24 # Check for no swap, and warn about it unless that is desired.
26 local es
27 swapctl -A -t noblk
28 es=$?
29 [ $es = 2 ] && es=0
30 if ! checkyesno no_swap; then
31 if swapctl -s | grep "no swap devices configured" > /dev/null;
32 then
33 warn "No swap space configured!"
34 es=1
37 return $es
40 # Remove all non-block-type swap devices
42 stop_cmd="swapctl -U -t noblk || [ $? = 2 ]"
44 load_rc_config swap
45 run_rc_command "$1"