Instantly share code, notes, and snippets.

Embed
What would you like to do?
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