cmkelley
Very Senior Member
Don't indent the swapon command.Hi, I have diversion installed in my ax88, and it insists on managing my swapper file through the post_mount script. This is fine with me, *except* that it wants to run the swapon command at *every* post_mount invocation.. and I have 2 USB drives hooked, being the drive where the swapper file exists mounted first, so 'swapon' gets called normally twice (the second one being unnecessary and even possibly risky)..
If I code an 'if' sentence in front of the swapper activation to make sure swapon is only ran when the partition holding the swapfile is mounted, then everytime I run the 'diversion' command the 'if' gets removed... and the file restored to the way diversion wants it to be.. is there any way to avoid this and tell diversion for instance that I will manage swapper my own ?
Code:
# If device has swapfile, start swap
SWP="$(find $1/myswap.swp 2> /dev/null)"
if [ "$SWP" ]; then
logger -t Swap "Starting swap"
swapon /path/to/swapfile/myswap.swp # Swap file created by Diversion
fi