Last active
July 26, 2018 16:54
-
-
Save NunoFilipeSantos/875ae548768dd8a34f7d0f2f88bd3d47 to your computer and use it in GitHub Desktop.
A Bash Script to copy files via SFTP from your remote Seedbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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