| 59 | |
| 60 | == Unmount == |
| 61 | |
| 62 | {{{ |
| 63 | #!/bin/bash |
| 64 | |
| 65 | # http://fuse.sourceforge.net/sshfs.html |
| 66 | |
| 67 | # the place file systems are to be mounted |
| 68 | MOUNT_POINT="/media" |
| 69 | if [[ ! -d "$MOUNT_POINT" ]]; then |
| 70 | echo "It looks like $MOUNT_POINT doesn't exist?" |
| 71 | exit |
| 72 | fi |
| 73 | |
| 74 | # check for server to unmount on standard input |
| 75 | if [[ $1 ]]; then |
| 76 | SERVER=$1 |
| 77 | elif [[ ! $1 ]]; then |
| 78 | echo "Type the server you want to unmount and then [ENTER]:" |
| 79 | read server |
| 80 | SERVER=$server |
| 81 | fi |
| 82 | |
| 83 | # check if the file system appears to already be mounted |
| 84 | DF=$(df | awk -F' ' '{ print $6 }' | grep "$MOUNT_POINT/$SERVER") |
| 85 | if [[ $DF ]]; then |
| 86 | echo "Umounting $SERVER at $DF?" |
| 87 | fusermount -u $MOUNT_POINT/$SERVER |
| 88 | exit |
| 89 | else |
| 90 | echo "It appears that $SERVER is not mounted" |
| 91 | fi |
| 92 | }}} |