Changes between Version 13 and Version 14 of SshfsMnt
- Timestamp:
- Oct 14, 2015, 12:55:48 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SshfsMnt
v13 v14 14 14 # http://fuse.sourceforge.net/sshfs.html 15 15 # 16 # Copyright 2015 Chris Croome 16 # Copyright 2015 Chris Croome 17 17 # Webarchitects Co-operative 18 18 # http://wwww.webarchitects.co.uk/ … … 38 38 39 39 # the place file systems are to be mounted 40 MOUNT _POINT="/media"41 if [[ ! -d "$MOUNT _POINT" ]]; then42 echo "It looks like $MOUNT _POINTdoesn't exist?"40 MOUNT="/media" 41 if [[ ! -d "$MOUNT" ]]; then 42 echo "It looks like $MOUNT doesn't exist?" 43 43 exit 1 44 44 fi … … 64 64 echo 65 65 exit 1 66 fi 67 66 fi 67 68 68 # check if the mount point exists and if not create it 69 if [[ ! -d "$MOUNT _POINT/$SERVER" ]]; then70 echo "Creating $MOUNT _POINT/$SERVER"71 mkdir "$MOUNT _POINT/$SERVER" || { echo "Failed to create $MOUNT_POINT/$SERVER" ; exit 1 ; }69 if [[ ! -d "$MOUNT/$SERVER" ]]; then 70 echo "Creating $MOUNT/$SERVER" 71 mkdir "$MOUNT/$SERVER" || { echo "Failed to create $MOUNT/$SERVER" ; exit 1 ; } 72 72 fi 73 73 74 74 # check is the file system appears to already be mounted 75 DF=$(df | awk -F' ' '{ print $6 }' | grep "$MOUNT _POINT/$SERVER")75 DF=$(df | awk -F' ' '{ print $6 }' | grep "$MOUNT/$SERVER") 76 76 if [[ $DF ]]; then 77 77 echo "It appears that $SERVER is already mounted at $DF?" … … 80 80 81 81 # Mount the file system 82 sshfs $SERVER:/ $MOUNT _POINT/$SERVER/ && \82 sshfs $SERVER:/ $MOUNT/$SERVER/ && \ 83 83 # if this succeeded 84 { echo "Mounted $SERVER:/ on $MOUNT _POINT/$SERVER/" ; exit 0 ; } || \84 { echo "Mounted $SERVER:/ on $MOUNT/$SERVER/" ; exit 0 ; } || \ 85 85 # if this failed 86 { echo "Problem mounting $SERVER:/ $MOUNT _POINT/$SERVER/" ; exit 1 ; }86 { echo "Problem mounting $SERVER:/ $MOUNT/$SERVER/" ; exit 1 ; } 87 87 88 88 echo "Oops how did we get here?" … … 123 123 124 124 # the place file systems are to be mounted 125 MOUNT _POINT="/media"126 if [[ ! -d "$MOUNT _POINT" ]]; then127 echo "It looks like $MOUNT _POINTdoesn't exist?"125 MOUNT="/media" 126 if [[ ! -d "$MOUNT" ]]; then 127 echo "It looks like $MOUNT doesn't exist?" 128 128 exit 1 129 129 fi … … 139 139 140 140 # check if the mount point exists 141 if [[ ! -d "$MOUNT _POINT/$SERVER" ]]; then142 echo "It looks like "$MOUNT _POINT/$SERVER" doesn't exist?"141 if [[ ! -d "$MOUNT/$SERVER" ]]; then 142 echo "It looks like "$MOUNT/$SERVER" doesn't exist?" 143 143 exit 1 144 144 fi 145 145 146 146 # check if the file system appears to already be mounted 147 DF=$(df | awk -F' ' '{ print $6 }' | grep -w "$MOUNT _POINT/$SERVER")147 DF=$(df | awk -F' ' '{ print $6 }' | grep -w "$MOUNT/$SERVER") 148 148 if [[ $DF ]]; then 149 149 # unmount the filesystem 150 fusermount -u $MOUNT _POINT/$SERVER && \150 fusermount -u $MOUNT/$SERVER && \ 151 151 # if success 152 152 { echo "Umounted $SERVER at $DF" ; exit 0 ; } || \ 153 153 # if mounting failed 154 { echo "Problem unmounting $MOUNT _POINT/$SERVER" ; exit 1 ; }154 { echo "Problem unmounting $MOUNT/$SERVER" ; exit 1 ; } 155 155 else 156 echo "It appears that $SERVER is not mounted at $MOUNT _POINT/$SERVER"156 echo "It appears that $SERVER is not mounted at $MOUNT/$SERVER" 157 157 exit 1 158 158 fi