#!/bin/sh mount /dev/ide/host0/bus0/target0/lun0/part1 /mnt/flash1 -o remount,rw,sync,noatime,nodiratime swapfilename="/mnt/flash1/swapfile" if [ -e "$swapfilename" ] then echo "Swap file $swapfilename found"; else echo "Swap file $swapfilename not found, creating" dd if=/dev/zero of="$swapfilename" bs=1024 count=65536 if [ "$?" -eq 0 ] then echo "Swapfile created successfully!" else echo "Failed to create swapfile" exit 1; fi fi grep "$swapfilename" /proc/swaps if [ -e "/proc/swaps" -a "$?" -eq 0 ] then echo "Swap already on" else echo "Turning swap on..." mkswap "$swapfilename" swapon "$swapfilename" fi exit 0