Example scripts

This commit is contained in:
2026-03-08 03:18:16 +00:00
parent 9ac970edd9
commit b6a31286f0
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/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