Thu 09 of Sep, 2010 [13:08 UTC]  
Menu

dumount

edit print PDF
Português Brasileiro
This script unmounts the filesystem and removes the mapper if the filesystem is not in use.

You can have cron run it every 10 minutes or so if you don't want your encrypted fs to be mounted all the time.
Change $mappername and $mpoint to match your setup.

#!/bin/sh

mappername="secure"
mpoint="/mnt/secure"

if grep $mpoint /etc/mtab > /dev/null; then
fuser -m $mpoint > /dev/null || (umount /mnt/secure/; cryptsetup remove $mappername)
else
echo $mpoint is not mounted!
if [ -e /dev/mapper/$mappername ]]; then
echo "Removing the mapper " $mappername
cryptsetup remove $mappername
fi
fi



Created by: gollo last modification: Tuesday 06 of July, 2010 [02:02:03 UTC] by Anonymous