public
Last active

Upstart task to scan for and activate any block devices with type swap; based on blkid.

  • Download Gist
automount-swaps.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# 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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.