#!/bin/bash # swap # Source functions library source /etc/rc.d/init.d/functions log_script_name "$0 $*" case "$1" in start) cmd_run_log_box "Enabling swap partition" swapon -a ;; stop) cmd_run_log_box "Disabling swap partition" swapoff -a ;; restart) $0 stop sleep 1 $0 start ;; status) swapon -s ;; *) echo "Usage: $0 {start|stop|restart|status}" exit ${EXIT_CODE_FAILURE} ;; esac exit $?