LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-14-2006, 09:39 AM   #1
madtinkerer
LQ Newbie
 
Registered: Sep 2006
Posts: 22

Rep: Reputation: 15
Limiting uploads as a ratio using btlaunchmany


Hi all,

I'd like to be able to limit uploads of bittorrent transfers by their upload ratio rather than upload speed. For example, I would like to launch a btlaunchmany command and have the program run until it is reached something like a 5:1 upload/download ratio, or has been seeded for a week, whatever comes first. I checked the man page for btlaunchmany but there doesn't seem to be any way to limit seeding according to the up/down ratio. Any idea how to do this?
 
Old 09-14-2006, 11:48 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
reached something like a 5:1 upload/download ratio, or has been seeded for a week
That's a damn good attitude, let's try and support that...


Any idea how to do this?
Here's a slightly different approach because I use btdownloadheadless.
It should go for .*many as well as long as it uses --spew which sets the logfile.
If you "reverse cat" (tac) the logfile and grep for the first string "upload rate:" and take the 3rd value you have the most current amount for upload. Take the archive/file size from running btshowmetainfo, mangle a bit, and you get:
Code:
#!/bin/sh
# where your running torrent files and logs reside
torrentdir="/var/bittorrent"
find "${torrentdir}" -type f -maxdepth 1 -iname \*.torrent | while read t; do
 if [ -f "${t%%.torrent}.log" ]; then log="${t%%.torrent}.log";
  u_size=($(tac "${log}" | grep -m1 "^upload total:")); u_size=${u_size[2]}; 
  t_size=($(btshowmetainfo.py "${t}" | grep -m1 "^[fa].*size")); 
  t_size=$(echo "scale=2;${t_size[2]}/1024/1024"|bc -l); f=${t//*\//}; f=${f%%.torrent}; 
  echo "${f} uploading:$(echo "scale=2;(${u_size%%.*} / ${t_size}) * 100"|bc -l)%"
 fi
done
exit 0
This is more like PoC and not what you want exactly, but it should be trivial to turn the output line in to some check-and-execute thingie.
 
Old 09-14-2006, 11:56 AM   #3
madtinkerer
LQ Newbie
 
Registered: Sep 2006
Posts: 22

Original Poster
Rep: Reputation: 15
Trivial for someone with 8,000 posts, not for one with about 5 :-) Thanks for the info though, I'll see what I can do with what you gave me. If I run that as a cron job, how do make sure that the torrent isn't activated twice? I'd like to have a directory where i can drop torrent files and have it check for new files every day or so and download them. I know the commands are there, I just can't figure out how to string them together. Thanks for the help again though. Tis always appreciated.
 
Old 09-14-2006, 12:16 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Trivial for someone with 8,000 posts, not for one with about 5 :-)
Never was my intention to emphasise that.


I'll see what I can do with what you gave me.
and you don't have to be doing that alone.
Here at LQ we've got some real scripting guru's.


If I run that as a cron job, how do make sure that the torrent isn't activated twice?
This script will only help in a situation where torrents are already running.


I'd like to have a directory where i can drop torrent files and have it check for new files every day or so and download them.
That could be done with another script. Just tell us where (what dir) you would like your torrents to be dropped in, and what arguments you run btmany with.


I know the commands are there, I just can't figure out how to string them together.
Yes, annoying isn't it? :-]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
btlaunchmany problem newbieX Linux - Newbie 1 04-17-2005 04:11 PM
"proftpftd.conf" limiting read access in uploads directory for non ftpadmin maxut Linux - Networking 0 09-04-2004 07:25 AM
Signal to Noise ratio legolas_t Linux - Wireless Networking 2 06-17-2004 08:48 AM
Motherboard Clock Ratio SML Linux - Newbie 11 02-20-2004 12:38 AM
16/9 aspect ratio abby_normal Linux - Software 4 11-03-2003 03:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration