#!/bin/bash # # swap Script to find and activate/deactivate swap partitions # # Author: Lee Wittenberg # # chkconfig: 12345 01 99 # description: Activates/deactivates all swap partitions # See how we were called. case "$1" in start) # Find and activate all swap partitions for x in `fdisk -l | awk '$5 == 82 {print $1}'` do swapon $x done ;; stop) # Find and deactivate all swap partitions for x in `fdisk -l | awk '$5 == 82 {print $1}'` do swapoff $x done ;; restart|reload) # do not do anything; this is unreasonable : ;; *) # do not advertise unreasonable commands that there is no reason # to use with this device echo $"Usage: $0 {start|stop|restart|reload}" exit 1 esac exit 0