Add much needed scripts to /etc/rc.d
[dragonfly.git] / etc / rc.d / swap2
1 #!/bin/sh
2 #
3 # $NetBSD: swap2,v 1.6 2002/03/22 04:34:00 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/swap2,v 1.2 2002/06/13 22:14:36 gordon Exp $
5 # $DragonFly: src/etc/rc.d/Attic/swap2,v 1.1 2003/07/24 06:35:37 dillon Exp $
6 #
7
8 # PROVIDE: nonlocalswap
9 # REQUIRE: mountcritremote
10 # BEFORE:  DAEMON
11
12 . /etc/rc.subr
13
14 name="swap2"
15 start_cmd="swap2_start"
16
17 swap2_start()
18 {
19         #       "Critical" file systems are now mounted.  Go ahead and swap
20         #       to files now, since they will be residing in the critical file
21         #       systems (or, at least, they should be...).
22         #       Check for no swap, and warn about it unless that is desired.
23         #
24         swapctl -A -t noblk;
25         if ! checkyesno no_swap; then
26                 if swapctl -s | grep "no swap devices configured" > /dev/null;
27                 then
28                         warn "No swap space configured!"
29                 fi
30         fi
31 }
32
33 #               Remove all non-block-type swap devices
34 #
35 stop_cmd="swapctl -U -t noblk"
36
37 load_rc_config swap
38 run_rc_command "$1"