Created
September 19, 2010 18:52
-
-
Save cnlpete/587007 to your computer and use it in GitHub Desktop.
script for rsnapshot calls, but mount the backup device, before this si done and unmount afterwards. Thisway, we might consume less power, because this is only done oncy a day (or week!!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RSNAPSHOT=/usr/bin/rsnapshot | |
DEVICE=/dev/disk/by-label/Backup | |
MOUNTPNT=/media/Backup | |
#--------------- | |
mounted=0 | |
#mount | |
mount | grep "on ${MOUNTPNT} type" > /dev/null | |
if [ ! $? -eq 0 ] ; then | |
echo mount $DEVICE $MOUNTPNT | |
mount $DEVICE $MOUNTPNT | |
if [ $? -eq 0 ] ; then | |
mounted=1 | |
fi | |
fi | |
#do snapshot with $1 as interval | |
echo $RSNAPSHOT $1 | |
$RSNAPSHOT $1 | |
#umount | |
if [ $mounted -eq 1 ] ; then | |
echo umount $DEVICE | |
umount $DEVICE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment