Created
November 9, 2020 13:45
-
-
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
This file contains 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 | |
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