Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # amended from https://github.com/Logvin/synctorrents/blob/master/synctorrents.sh
- # I take no credit other than amending and pasting here.
- #!/bin/bash
- #login information for your remote host, no quotes
- login=xxxxx
- #password information for your remote host, no quotes
- pass=xxxxx
- #host info for your remote host. include full URL standard format is sftp://ftp.servername.com
- host=sftp://xxxxx.xxxxx.xxxxx
- #remote location where your finished downloads are on your seedbox
- remote_dir=/where/your/files/are/on/remote/host
- #local directory where you are storing your downloads for further processing
- local_dir=/where/you/want/the/files/to/go/locally
- #the next few lines checks if lftp is running and stops the script if so. Will also show the PID if you want to kill the lftp from running manually (although you can use pkill lftp)
- checkifrunning=`(ps -aux | grep [l]ftp | awk '{print $2}')`
- if [[ $checkifrunning ]]; then
- echo "Synctorrent is running already. PID " $checkifrunning
- exit 1
- else
- # Runs the lftp to sync, please amend xxxxx to your ssh / sftp port if required or remove the -p xxxxx option altogether if desired.
- # command use-pget-n=20 uses 20 threads, command -P1 does one file at a time. Amend as needed keeping in mind not flooding your remote host with too many connections.
- # command --log=lftp_logs.log will write to the log location you specify, for troubleshooting. Remove if not needed.
- lftp -u $login,$pass $host -p xxxxx << EOF
- mirror --use-pget-n=20 -P1 -c --log=lftp_logs.log $remote_dir $local_dir
- quit
- EOF
- exit 0
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement