- #!/bin/bash
- ip=10.0.0.2
- drives="F G H Z"
- case $1 in
- mount)
- ping -c1 $ip &>/dev/null
- if [[ $? -eq 0 ]]; then
- for drive in $drives; do
- sudo mount -t cifs //${ip}/${drive} -o username=USER,password=PASS /mnt/${drive}
- if [[ $? -eq 0 ]]; then
- printf 'Successfully mounted //%s/%s to /mnt/%s\n' "$ip" "$drive" "$drive"
- else
- printf 'Could not mount //%s/%s to /mnt/%s\n' "$ip" "$drive" "$drive"
- fi
- done
- else
- printf 'Could not get a response from %s\n' "$ip"
- fi
- ;;
- umount)
- for drive in $drives; do
- sudo umount /mnt/${drive}
- if [[ $? -eq 0 ]]; then
- printf 'Successfully unmounted /mnt/%s\n' "$drive"
- else
- printf 'Could not unmount /mnt/%s\n' "$drive"
- fi
- done
- ;;
- status)
- mount -t cifs
- ;;
- esac
mount script
Posted by z0TK on Thu 8th Jul 2010 01:00
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.