Skip to content

Instantly share code, notes, and snippets.

@naumvd95
Created November 9, 2020 13:45
Show Gist options
  • Save naumvd95/cdf4fed0f92e73e470a91dc2f4270b7f to your computer and use it in GitHub Desktop.
Save naumvd95/cdf4fed0f92e73e470a91dc2f4270b7f to your computer and use it in GitHub Desktop.
Mount SSHFS & fetch logs on remote machine to speedup downloading in case of fucking slow home network speed
#!/bin/bash
set -ex
# MacOS quickstart: https://sbgrid.org/corewiki/faq-sshfs
: "${LOCAL_DIR:=sshfs_mount_point}"
: "${REMOTE_DIR:=/home/ubuntu}"
: "${USERNAME:=ubuntu}"
: "${HOST:=}"
: "${SSH_KEYPATH:=~/.ssh/id_rsa}"
mkdir -p ${LOCAL_DIR}
sshfs -o ssh_command="ssh -i ${SSH_KEYPATH}" ${USERNAME}@${HOST}:${REMOTE_DIR} ${LOCAL_DIR}
# USE BELOW SCRIPT IN SEPARATE FILE###################################################
#!/bin/bash
set -ex
: "${URL:=http://whattofetch.com/to/remote/machine.tgz}"
: "${REMOTE_DIR:=/home/ubuntu}"
: "${USERNAME:=ubuntu}"
: "${HOST:=}"
: "${SSH_KEYPATH:=~/.ssh/id_rsa}"
ssh -i ${SSH_KEYPATH} ${USERNAME}@${HOST} wget ${URL} -P ${REMOTE_DIR}
# USE BELOW SCRIPT IN SEPARATE FILE###################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment