#!/bin/bash # chkconfig: 2345 99 99 # description: Enable swap file. # Source function library. . /etc/init.d/functions SWAPFILE=/var/cache/swap [ -f $SWAPFILE ] || exit 0 case "$1" in start) echo -n $"Enable $SWAPFILE: " swapon $SWAPFILE && success "swapfile startup" || failure "swapfile startup" echo ;; stop) echo -n $"Disable $SWAPFILE: " swapoff $SWAPFILE && success "swapfile shutdown" || failure "swapfile shutdown" echo ;; status) swapon -s ;; *) echo $"Usage: $0 {start|stop|status}" exit 1 esac exit $?