Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Author: Nyle Davis Created 14-05-26
- # Purpose: Find and mount USB/Flash drive(s), returning size of each
- # File: mount-drives.sh
- # CRON: This script is CRON compatible and executable
- # Background: The script is Background compatible and executable
- function usbscan {
- for DEV in /sys/block/sd*; do
- if readlink $DEV | grep -q usb; then
- DEV=`basename $DEV`;
- if [ -d /sys/block/${DEV}/${DEV}1 ]; then
- devdrv=$DEV[0-9]*;
- echo "Has partitions " /sys/block/$DEV/${devdrv};
- MOUNT=`df | grep $DEV | awk '{print $6}'`;
- if [ -z ${MOUNT} ]; then
- # Use hardcode for next 3 line to mount the flash on Aspire
- mkdir /mnt/flash;
- mkdir /mnt/flash/64Gig;
- mount /dev/${devdrv} /mnt/flash/64Gid;
- MOUNT=`df | grep $DEV | awk '{print $6}'`;
- fi
- echo "Mount ==> " ${MOUNT};
- else
- echo "Has no partitions"
- fi
- fi
- done }
- usbscan;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement