Created
October 27, 2017 09:15
-
-
Save joltcan/1544592c4cc767836d57ba480013f3b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MOUNTPATH=/Volumes/<somepath> | |
USERNAME=<user> | |
SERVER=<server> | |
KEYFILE=/home/<user>/.ssh/<keyfile> | |
if [ ! -d "$MOUNTPATH ]; then mkdir -p "$MOUNTPATH" ; fi | |
function mountdisk { | |
# first we unmount since we don't trust sshfsmounts really | |
sudo fusermount -uzq "$MOUNTPATH" > /dev/null 2>&1 | |
sudo umount -fl "$MOUNTPATH" > /dev/null 2>&1 | |
sudo sshfs $USER@$SERVER:/ftp/ftp "$MOUNTPATH" -o follow_symlinks,allow_other,port=22 -o IdentityFile="$KEYFILE" -o kernel_cache -o Ciphers=aes128-ctr -o auto_cache -o cache_timeout=600 -o attr_timeout=115200 -o entry_timeout=300 -o max_readahead=90000 -o no_remote_lock -o big_writes | |
} | |
dev=`df -P "$MOUNTPATH" 2>&1 | awk 'BEGIN {e=1} $NF ~ /^\/.+/ { e=0 ; print $1 ; exit } END { exit e }'` && { | |
exit 0 | |
} || { | |
# here we call our function from above | |
mountdisk | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment