#/bin/bash # # This script runs before the main rdiffbackup script # useful for mounting USB drives # # # USB_PREFIX="mdaakl0" POSSIBLE_USB_DRIVES="1 2 3 4" MOUNT_POINT="/mnt" USB_DRIVE="unknowndrive" MOUNT_OPTIONS="rw,noatime,acl" # # if mount | grep $MOUNT_POINT then echo "WARNING - A Drive is already mounted on $MOUNT_POINT">> $LOGFILE 2>> $LOGFILE INITIAL_CMD_FILE_OK="false" else for i in $POSSIBLE_USB_DRIVES do if mount LABEL=$USB_PREFIX$i $MOUNT_POINT -o $MOUNT_OPTIONS then USB_DRIVE="$USB_PREFIX$i" echo "Using $USB_DRIVE on $MOUNT_POINT">> $LOGFILE 2>> $LOGFILE break fi done if [ $USB_DRIVE == "unknowndrive" -o $MOUNT_POINT"xxx" == "xxx" ] then echo "ERROR - Was not able to mount the USB drive, either the Device is not available, or the mount point does not exist" >> $LOGFILE 2>> $LOGFILE INITIAL_CMD_FILE_OK="false" fi fi