7.1
Line | |
---|
1 | #!/bin/sh
|
---|
2 | # Begin $RC_BASE/init.d/swap
|
---|
3 |
|
---|
4 | ### BEGIN INIT INFO
|
---|
5 | # Provides: swap
|
---|
6 | # Required-Start: udev
|
---|
7 | # Should-Start: modules
|
---|
8 | # Required-Stop: localnet
|
---|
9 | # Should-Stop:
|
---|
10 | # Default-Start: S
|
---|
11 | # Default-Stop: 0 6
|
---|
12 | # Short-Description: Mounts and unmounts swap partitions.
|
---|
13 | # Description: Mounts and unmounts swap partitions defined in
|
---|
14 | # /etc/fstab.
|
---|
15 | # X-LFS-Provided-By: LFS
|
---|
16 | ### END INIT INFO
|
---|
17 |
|
---|
18 | . /lib/lsb/init-functions
|
---|
19 |
|
---|
20 | case "${1}" in
|
---|
21 | start)
|
---|
22 | message="Activating all swap files/partitions..."
|
---|
23 | swapon -a
|
---|
24 | evaluate_retval standard
|
---|
25 | ;;
|
---|
26 |
|
---|
27 | stop)
|
---|
28 | message="Deactivating all swap files/partitions..."
|
---|
29 | swapoff -a
|
---|
30 | evaluate_retval standard
|
---|
31 | ;;
|
---|
32 |
|
---|
33 | restart)
|
---|
34 | swapoff -a
|
---|
35 | error_level="${?}"
|
---|
36 | sleep 1
|
---|
37 | swapon -a
|
---|
38 | error_level="$(( ${error_level} + ${?} ))"
|
---|
39 | (exit "${error_level}")
|
---|
40 | evaluate_retval restart
|
---|
41 | ;;
|
---|
42 |
|
---|
43 | status)
|
---|
44 | log_success_msg "Retrieving swap status..."
|
---|
45 | echo
|
---|
46 | swapon -s
|
---|
47 | ;;
|
---|
48 |
|
---|
49 | *)
|
---|
50 | echo "Usage: ${0} {start|stop|restart|status}"
|
---|
51 | exit 1
|
---|
52 | ;;
|
---|
53 | esac
|
---|
54 |
|
---|
55 | # End $RC_BASE/init.d/swap
|
---|
Note:
See
TracBrowser
for help on using the repository browser.