29 lines
1.4 KiB
Bash
29 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Put this on the local machine. This will run remote-dl.sh on the remote machine, then download the episodes over rsync to the local machine.
|
|
|
|
# DO NOT CHANGE THESE
|
|
M_ERR=$(printf '\e[1;31mERROR:\e[0m')
|
|
ISNUMBER='^[0-9]+$'
|
|
EPISODE=$1
|
|
# DO NOT CHANGE THESE
|
|
|
|
# CHANGE THESE
|
|
SRC_USER=remoteuser # The remote server user
|
|
SRC_HOST=server.local # The remote server hostname/IP
|
|
SRC_DL_DIR=/home/remoteexampleuser/autosnatch/beacon-downloads/ # The remote directory in which autosnatch is set to save its downloads
|
|
SRC_AUTOSNATCHDIR=/home/remoteexampleuser/autosnatch # The directory in which you put the autosnatch files on the remote machine
|
|
DEST_DL_DIR=/home/exampleuser/beacon-downloads/ # Where you want the files to download to on your local mahcine
|
|
PRIVKEY=/home/exampleuser/.ssh/id_ed25519 # Cron needs to know with which private key to connect to the seedbox
|
|
|
|
if ! [[ $EPISODE =~ $ISNUMBER ]] ; then
|
|
if ! [[ $EPISODE = 'latest' ]] ; then
|
|
echo -e "$M_ERR Missing or invalid episode number" >&2; exit 1
|
|
fi
|
|
fi
|
|
|
|
# Trigger the remote server to download the latest episodes
|
|
ssh -i $PRIVKEY $SRC_USER@$SRC_HOST -t $SRC_AUTOSNATCHDIR/scripts/remote-dl.sh critical-cooldown
|
|
ssh -i $PRIVKEY $SRC_USER@$SRC_HOST -t $SRC_AUTOSNATCHDIR/scripts/remote-dl.sh campaign-4
|
|
|
|
# Pull the episodes from the remote server to your local machine
|
|
rsync -avzhP -e "ssh -i $PRIVKEY" $SRC_USER@$SRC_HOST:$SRC_DL_DIR $DEST_DL_DIR |