#/bin/bash -x # # This script runs before the main rdiffbackup script # useful for mounting USB drives # # returns # nothing if successful # 1 = error on umount command # 2 = parameters not defined # 3 = no file system mounted # # if [ $MOUNT_POINT"xxx" == "xxx" ] then echo "ERROR - Mount point not defined in initial.sh file" >> $LOGFILE fi # if mount | grep $MOUNT_POINT > /dev/null then if ! umount $MOUNT_POINT then echo "ERROR - Couldn't unmount $MOUNT_POINT" >> $LOGFILE else if [ $FS_CHECK == true ] then echo "" echo "" echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE echo " Running a File system check on $USB_DRIVE" >> $LOGFILE echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE if ! $FSCK_COMMAND -fvp $USB_DRIVE >> $LOGFILE then echo "Error running the filesystem check" >> $LOGFILE else #Setting the last check time to now, and the check interval to 6 months $TUNE2FS_COMMAND -T now $USB_DRIVE $TUNE2FS_COMMAND -i 6m $USB_DRIVE echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE echo "Filesystem check of $USB_DRIVE was successful" >> $LOGFILE echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE fi else echo "" echo "" echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE echo " Next USB Drive check scheduled for $CHECK_DATE_STRING" >> $LOGFILE echo "++++++++++++++++++++++++++++++++++++++++++" >> $LOGFILE fi fi else echo "ERROR - no file system on $MOUNT_POINT" >> $LOGFILE fi