Last active
December 14, 2015 04:59
-
-
Save UnwashedMeme/5032381 to your computer and use it in GitHub Desktop.
Upstart task to scan for and activate any block devices with type swap; based on blkid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# automount-swaps scans for any block devices with type swap (as | |
# identified by blkid) and activates them with swapon. | |
# | |
description "Automount swap devices" | |
start on all-swaps #generated by mountall | |
task | |
script | |
logger -t automount-swaps "Starting automount-swaps." | |
blkid -t TYPE=swap -o device | while read d; do | |
if ! ( swapon -s | grep -q "$d" ); then | |
printf "Activating %s\n" "$d" | logger -t automount-swaps | |
swapon --fixpgsz $d | |
fi | |
done | |
end script | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment