aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-11-18 13:43:16 -0200
committerSilvio Rhatto <rhatto@riseup.net>2012-11-18 13:43:16 -0200
commitdf51b9c44c30ea8a255fb7f93b4640c82fb36231 (patch)
tree20bb80f2385716b1cf6fc27b7a01a7139a5886cf
parent1c1ab7c6897562bf8af101a0c9802192088a9924 (diff)
downloadpuppet-backup-df51b9c44c30ea8a255fb7f93b4640c82fb36231.tar.gz
puppet-backup-df51b9c44c30ea8a255fb7f93b4640c82fb36231.tar.bz2
Avoid sleep mode on volumes
-rwxr-xr-xfiles/mount-media4
1 files changed, 3 insertions, 1 deletions
diff --git a/files/mount-media b/files/mount-media
index 28a7400..b450605 100755
--- a/files/mount-media
+++ b/files/mount-media
@@ -7,11 +7,12 @@
MEDIA="$1"
VOLUME="$2"
BASENAME="`basename $0`"
+DISK="`echo ${MEDIA} | sed -e s/[0-9]\$//g`"
# Check media config
if [ -z "$MEDIA" ]; then
echo "usage: $BASENAME <media> [volume]"
- echo "example: $BASENAME magnetron sdb1"
+ echo "example: $BASENAME mymedia sdb1"
exit 1
fi
@@ -26,6 +27,7 @@ if [ "`whoami`" != 'root' ]; then
fi
if [ "$BASENAME" == "mount-media" ]; then
+ $sudo sdparm --clear STANDBY -6 /dev/$DISK
$sudo cryptsetup luksOpen /dev/$VOLUME $MEDIA && \
$sudo fsck -v -y /dev/mapper/$MEDIA && \
$sudo mount /dev/mapper/$MEDIA /media/usb