Skip to content

Instantly share code, notes, and snippets.

@sea3pea0
Created June 18, 2015 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sea3pea0/0f31754915805d054d59 to your computer and use it in GitHub Desktop.
Save sea3pea0/0f31754915805d054d59 to your computer and use it in GitHub Desktop.
#!/opt/bin/bash
login=login
pass=password
host=host.com
remote_dir=/remote/dir
local_dir=/local/dir
trap "rm -f /tmp/torrentsync.lock" SIGINT SIGTERM
if [ -e /tmp/torrentsync.lock ]
then
echo "TorrentSync is running already."
exit 1
else
touch /tmp/torrentsync.lock
/usr/bin/lftp -u $login,$pass $host << EOF
set ftp:ssl-allow yes
set ssl:verify-certificate no
set mirror:use-pget-n 5
set xfer:temp-file-name *.!Sync
set xfer:use-temp-file yes
mirror -c --loop --Remove-source-files -P3 -X *.r?? -X *sample* -X *.jpg -X *.nfo -X *.sfv -X *.txt --no-empty-dirs $remote_dir $local_dir
quit
EOF
#
rm -f /tmp/torrentsync.lock
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment