aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.d/init.d/swap
diff options
context:
space:
mode:
authorjack <[email protected]>2023-11-20 13:22:56 -0700
committerjack <[email protected]>2023-11-20 13:22:56 -0700
commit0fd7df369678bb805fbc523b00eded9f0d699f18 (patch)
tree86c3ba72f43b3087c03fd416c4a8cfb128a30cab /etc/rc.d/init.d/swap
parent381d614a915efefc8edd8e40b810120f66fe7c3c (diff)
downloaddots-0fd7df369678bb805fbc523b00eded9f0d699f18.tar.gz
dots-0fd7df369678bb805fbc523b00eded9f0d699f18.zip
misc
Diffstat (limited to 'etc/rc.d/init.d/swap')
-rwxr-xr-xetc/rc.d/init.d/swap63
1 files changed, 63 insertions, 0 deletions
diff --git a/etc/rc.d/init.d/swap b/etc/rc.d/init.d/swap
new file mode 100755
index 00000000..14075ae1
--- /dev/null
+++ b/etc/rc.d/init.d/swap
@@ -0,0 +1,63 @@
+#!/bin/sh
+########################################################################
+# Begin swap
+#
+# Description : Swap Control Script
+#
+# Authors : Gerard Beekmans - [email protected]
+# DJ Lucas - [email protected]
+# Update : Bruce Dubbs - [email protected]
+#
+# Version : LFS 7.0
+#
+########################################################################
+
+### BEGIN INIT INFO
+# Provides: swap
+# Required-Start: udev
+# Should-Start: modules
+# Required-Stop: localnet
+# Should-Stop: $local_fs
+# Default-Start: S
+# Default-Stop: 0 6
+# Short-Description: Activates and deactivates swap partitions.
+# Description: Activates and deactivates swap partitions defined in
+# /etc/fstab.
+# X-LFS-Provided-By: LFS
+### END INIT INFO
+
+. /lib/lsb/init-functions
+
+case "${1}" in
+ start)
+ log_info_msg "Activating all swap files/partitions..."
+ swapon -a
+ evaluate_retval
+ ;;
+
+ stop)
+ log_info_msg "Deactivating all swap files/partitions..."
+ swapoff -a
+ evaluate_retval
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ log_success_msg "Retrieving swap status."
+ swapon -s
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# End swap