7.1
Rev | Line | |
---|
[1c48007] | 1 | #!/bin/sh
|
---|
[f3f65e73] | 2 | # Begin $RC_BASE/init.d/swap
|
---|
[1c48007] | 3 |
|
---|
| 4 | ### BEGIN INIT INFO
|
---|
| 5 | # Provides: swap
|
---|
[d03909f] | 6 | # Required-Start: udev
|
---|
[67de919] | 7 | # Should-Start: modules
|
---|
[614a14e] | 8 | # Required-Stop: localnet
|
---|
[010d108] | 9 | # Should-Stop:
|
---|
| 10 | # Default-Start: S
|
---|
| 11 | # Default-Stop: 0 6
|
---|
[1c48007] | 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 |
|
---|
[f3f65e73] | 55 | # End $RC_BASE/init.d/swap
|
---|
Note:
See
TracBrowser
for help on using the repository browser.