Changes between Version 13 and Version 14 of SshfsMnt


Ignore:
Timestamp:
Oct 14, 2015, 12:55:48 PM (3 years ago)
Author:
chris
Comment:

s/MOUNT_POINT/MOUNT/ for consistency

Legend:

Unmodified
Added
Removed
Modified
  • SshfsMnt

    v13 v14  
    1414# http://fuse.sourceforge.net/sshfs.html
    1515#
    16 # Copyright 2015 Chris Croome 
     16# Copyright 2015 Chris Croome
    1717# Webarchitects Co-operative
    1818# http://wwww.webarchitects.co.uk/
     
    3838
    3939# the place file systems are to be mounted
    40 MOUNT_POINT="/media"
    41 if [[ ! -d "$MOUNT_POINT" ]]; then
    42   echo "It looks like $MOUNT_POINT doesn't exist?"
     40MOUNT="/media"
     41if [[ ! -d "$MOUNT" ]]; then
     42  echo "It looks like $MOUNT doesn't exist?"
    4343  exit 1
    4444fi
     
    6464  echo
    6565  exit 1
    66 fi 
    67    
     66fi
     67
    6868# check if the mount point exists and if not create it
    69 if [[ ! -d "$MOUNT_POINT/$SERVER" ]]; then
    70   echo "Creating $MOUNT_POINT/$SERVER"
    71   mkdir "$MOUNT_POINT/$SERVER" || { echo "Failed to create $MOUNT_POINT/$SERVER" ; exit 1 ; }
     69if [[ ! -d "$MOUNT/$SERVER" ]]; then
     70  echo "Creating $MOUNT/$SERVER"
     71  mkdir "$MOUNT/$SERVER" || { echo "Failed to create $MOUNT/$SERVER" ; exit 1 ; }
    7272fi
    73  
     73
    7474# check is the file system appears to already be mounted
    75 DF=$(df | awk -F' ' '{ print $6 }' | grep "$MOUNT_POINT/$SERVER")
     75DF=$(df | awk -F' ' '{ print $6 }' | grep "$MOUNT/$SERVER")
    7676if [[ $DF ]]; then
    7777  echo "It appears that $SERVER is already mounted at $DF?"
     
    8080
    8181# Mount the file system
    82 sshfs $SERVER:/ $MOUNT_POINT/$SERVER/ && \
     82sshfs $SERVER:/ $MOUNT/$SERVER/ && \
    8383  # if this succeeded
    84   { echo "Mounted $SERVER:/ on $MOUNT_POINT/$SERVER/" ; exit 0 ; } || \
     84  { echo "Mounted $SERVER:/ on $MOUNT/$SERVER/" ; exit 0 ; } || \
    8585  # if this failed
    86   { echo "Problem mounting $SERVER:/ $MOUNT_POINT/$SERVER/" ; exit 1 ; }
     86  { echo "Problem mounting $SERVER:/ $MOUNT/$SERVER/" ; exit 1 ; }
    8787
    8888echo "Oops how did we get here?"
     
    123123
    124124# the place file systems are to be mounted
    125 MOUNT_POINT="/media"
    126 if [[ ! -d "$MOUNT_POINT" ]]; then
    127   echo "It looks like $MOUNT_POINT doesn't exist?"
     125MOUNT="/media"
     126if [[ ! -d "$MOUNT" ]]; then
     127  echo "It looks like $MOUNT doesn't exist?"
    128128  exit 1
    129129fi
     
    139139
    140140# check if the mount point exists
    141 if [[ ! -d "$MOUNT_POINT/$SERVER" ]]; then
    142   echo "It looks like "$MOUNT_POINT/$SERVER" doesn't exist?"
     141if [[ ! -d "$MOUNT/$SERVER" ]]; then
     142  echo "It looks like "$MOUNT/$SERVER" doesn't exist?"
    143143  exit 1
    144144fi
    145145 
    146146# check if the file system appears to already be mounted
    147 DF=$(df | awk -F' ' '{ print $6 }' | grep -w "$MOUNT_POINT/$SERVER")
     147DF=$(df | awk -F' ' '{ print $6 }' | grep -w "$MOUNT/$SERVER")
    148148if [[ $DF ]]; then
    149149  # unmount the filesystem
    150   fusermount -u $MOUNT_POINT/$SERVER && \
     150  fusermount -u $MOUNT/$SERVER && \
    151151    # if success
    152152    { echo "Umounted $SERVER at $DF" ; exit 0 ; } || \
    153153    # if mounting failed
    154     { echo "Problem unmounting $MOUNT_POINT/$SERVER" ; exit 1 ; }
     154    { echo "Problem unmounting $MOUNT/$SERVER" ; exit 1 ; }
    155155else
    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"
    157157  exit 1
    158158fi