Skip to content

Instantly share code, notes, and snippets.

@NunoFilipeSantos
Last active July 26, 2018 16:54
Show Gist options
  • Save NunoFilipeSantos/875ae548768dd8a34f7d0f2f88bd3d47 to your computer and use it in GitHub Desktop.
Save NunoFilipeSantos/875ae548768dd8a34f7d0f2f88bd3d47 to your computer and use it in GitHub Desktop.
A Bash Script to copy files via SFTP from your remote Seedbox
#!/bin/bash
login=$YOURUSERNAME
pass=$YOURPASSWORD
host=sftp://YOURIPADDRESS
remote_dir=/$YOURDOWNLOADFOLDER
local_dir=/$YOURLOCALFOLDER
trap "rm -f /tmp/synctorrent.lock" SIGINT SIGTERM
if [ -e /tmp/synctorrent.lock ]
then
echo "Synctorrent is running already."
exit 1
else
touch /tmp/synctorrent.lock
lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set sftp:auto-confirm yes
set mirror:use-pget-n 5
mirror --Remove-source-files -c -P5 --log=synctorrents.log $remote_dir $local_dir
quit
EOF
rm -f /tmp/synctorrent.lock
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment