#!/bin/bash # Copy No-Intro roms into staging directories exit readonly SSHUSER=files readonly SSHHOST=supertux.asuscomm.com readonly SSHPASSWORD=filesdyson7 readonly SSHHOSTPORT=65535 # Files older than this many days won't be synced - dont set more than a few days readonly SYNCDAYS=7 # Rsync download bandwidth - set below maximum incoming to still have usable internet readonly BWLIMIT=2500 # How many seconds should rsync run before it quits to give another rsync a chance? readonly WARNTIME=99999 sync() { local directory="$@" echo timelimit -t ${WARNTIME} sshpass -p ${SSHPASSWORD} ssh -p ${SSHHOSTPORT} ${SSHUSER}@${SSHHOST} \ find ${directory} -mtime -${SYNCDAYS} -print0 \ sshpass -p ${SSHPASSWORD} \ timelimit -t ${WARNTIME} \ rsync -e "ssh -p ${SSHHOSTPORT}" -0v --bwlimit=${BWLIMIT} --append-verify --inplace --files-from=- ${SSHUSER}@${SSHHOST}:/ / sshpass -p ${SSHPASSWORD} ssh -p ${SSHHOSTPORT} ${SSHUSER}@${SSHHOST} \ find ${directory} -mtime -${SYNCDAYS} -print0 | \ sshpass -p ${SSHPASSWORD} \ timelimit -t ${WARNTIME} \ rsync -e "ssh -p ${SSHHOSTPORT}" -0v --bwlimit=${BWLIMIT} --append-verify --inplace --files-from=- ${SSHUSER}@${SSHHOST}:/ / } main() { source /mnt/plex/bin/lock.sh sync /mnt/plex/Movies sync /mnt/plex/Bootlegs sync /mnt/plex/TV_Shows } main