Skip to content

Instantly share code, notes, and snippets.

@warpfork
Created January 30, 2015 03:38
Show Gist options
  • Save warpfork/42c6970121fd7e952c30 to your computer and use it in GitHub Desktop.
Save warpfork/42c6970121fd7e952c30 to your computer and use it in GitHub Desktop.
sshfs
#!/bin/bash
mkdir -p "${locPath}" && \
trap '( fusermount -u "${locPath}" && rmdir "${locPath}" ) 2>/dev/null ; exit $?' INT TERM EXIT && \
(
declare -a opts
opts=();
opts+=("-o sshfs_sync"); # synchronous writes
opts+=("-o no_readahead"); # synchronous reads
opts+=("-o reconnect"); # try harder
opts+=("-f"); # run in foreground
#opts+=("-d"); # debug, so i know you're alive
sshfs \
"${rmtWho}"@"${rmtHost}":"$rmtPath" \
"${locPath}" \
${opts[@]} \
|| { echo "mount attempt asploded :'(" 1>&2 ; exit 3; }
) && \
echo "mounted! :D" 1>&2 #&& \
#while true; do sleep 10; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment