Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env sh
- # check if share is mounted, attempt recovery and remount
- if [ -z "$1" ]; then
- echo "Usage: $0 /mount/point/to/check"
- exit 0
- fi
- DIR="$1"
- if grep -qs "$DIR" /proc/mounts; then
- # echo "$DIR is mounted."
- exit 0
- else
- echo "$DIR is not mounted."
- if [ "$(ls -A $DIR)" ]; then
- NEWDIR="$DIR-`date +%F-%k-%M-%S`"
- echo "Files exist so renaming $DIR -> $NEWDIR"
- mv "$DIR" "$NEWDIR"
- mkdir -p "$DIR"
- fi
- echo "Attempt remount..."
- mount -a
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement