[SOLVED] Problem with rutorrent/rtorrent automation

somus1735

Member
May 25, 2018
833
0
16
Hey guys,

I have been using rutorrent/rtorrent for the past couple of months, but have only recently started to automate the process of downloading and uploading. The downloading works perfectly but now I want rutorrent/rtorrent to auto upload when it completes downloading, I have another script that handles that, but rutorrent/rtorrent should call the script after downloaded, what I did was add an extra line to .rtorrent.rc, but with no luck.

Could some1 perhaps help me out here.

My first 5 lines of .rtorrent.rc:

# rTorrent configuration file
#
# While editing: please remember there are other people on your server!

system.method.set_key = event.download.finished,upload_torrent,"execute=/home/****/upload/wrapper,rtorrent,$d.get_chunk_size=,$d.get_base_path="

The above glowing part is what I added to the file to call the script, but it doesn't work? The other script is scars bash torrent uploader
 

dsouvik215

Member
May 25, 2018
896
0
16
1) Try this:
system.method.set_key = event.download.finished,upload_torrent,"execute={/home/****/upload/wrapper,rtorrent,$d.get_chunk_size=,$d.get_base_path=}"
2) Add to the begin of .rtorrent.rc (before event.download.finished handler) command
log.execute=/tmp/exec.log
download torrent and check log contents - is your script called.
3) See to rtorrent console after torrent download - may be, rtorrent say to you something?
 

somus1735

Member
May 25, 2018
833
0
16
I am using a seedbox, so have access to rutorrent, ftp, and putty, but not rtorrent directly?
 

somus1735

Member
May 25, 2018
833
0
16
Quote
Try to paste this command in the rtorrent console. With Ctrl-X. What happens?​


Okay I have done like you said but in putty screen,

I inserted the command, but there wasn't any response or message?
 

somus1735

Member
May 25, 2018
833
0
16
Quote
Try to paste this command in the rtorrent console. With Ctrl-X. What happens?​


Okay, so I kept the screen open and downloaded something, the screen was giving me the following:

Download event action failed: Bad return code.

If that is relating to the script I am using, then how will I be able to insert a code that runs a command after download completes, for example:

after download reaches 100%, run: upload $filename
 

dsouvik215

Member
May 25, 2018
896
0
16
1) I mean - command "log.execute=/tmp/exec.log"
2) If message "Download event action failed: Bad return code" has relation to your script, then this mean - your script was runned, but as result it return non-zero code. Check your script, add debug messages to it, for example.
 

somus1735

Member
May 25, 2018
833
0
16
Quote
1) I mean - command "log.execute=/tmp/exec.log"
2) If message "Download event action failed: Bad return code" has relation to your script, then this mean - your script was runned, but as result it return non-zero code. Check your script, add debug messages to it, for example.​


I see. The script was obtained vi scars bash torrent uploader.


how do I run the following command when download finnishes:

upload $torrentbasefolder


Where ($torrentbasefolder) is the downloaded contents main folder pulled from rtorrrent?




MY SCRIPT:
# if invoked by the webui
if [ $1 = "webui" ]; then
if [ $2 = "reset" ]; then
if [ -d "$3" ]; then
rm -rf "$3/.uploading"
rm -rf "$3/.uploaded"
rm -rf "$3/.uploaderror"
fi
elif [ $2 = "hide" ]; then
if [ -d "$3" ] && [ ! -d "$3/.hidden" ]; then
mkdir "$3/.hidden"
fi
else
if [ -n "$5" ] && [[ $5 =~ ^[0-9]*$ ]] && [ $5 -ge 15 ] && [ $5 -le 28 ]; then
upload -y $5 -r "$2" -c "$3" "$4" >/dev/null 2>&1 &
else
upload -r "$2" -c "$3" "$4" >/dev/null 2>&1 &
fi
fi
# if invoked by rtorrent
elif [ $1 = "rtorrent" ]; then

upload -z $2 "$3" >/dev/null 2>&1 &
fi
 

dsouvik215

Member
May 25, 2018
896
0
16
Quote
how do I run the following command when download finnishes:​


See to your first posting.

/home/****/upload/wrapper - script path
$d.get_chunk_size= - chunk size
$d.get_base_path= - main torrents folder.
 

dsouvik215

Member
May 25, 2018
896
0
16
Re: Problem with rutorrent/rtorrent automation
« Reply #10 on: January 18, 2012, 06:38:01 am »

Quote
Quote
how do I run the following command when download finnishes:​

See to your first posting.

/home/****/upload/wrapper - script path
$d.get_chunk_size= - chunk size
$d.get_base_path= - main torrents folder.​

Thank you very much, got it working.

Last question.

How do I set a default ratio group for watched directory, and another for the rest?

Watch directory = Ratio 8
Other = Ratio 2
 

dsouvik215

Member
May 25, 2018
896
0
16
Don't know.
You may try to use
view.set_visible=rat_8
after load operator in the watch shedule and set default ratio to 2 in the plugin ratio.
 

shwetha17

Member
May 24, 2018
785
0
16
BTW, log.execute is broken in the 0.8.9 release, unless you patch it to working order.

And the full redirects in your wrapper script make you blind against ANY future error, it'd be much more prudent to redirect to a log file there.
 

somus1735

Member
May 25, 2018
833
0
16
Hi,

I have scraped that script and just added the below line to .rtorrent.rc and it works perfectly.


system.method.set_key = event.download.finished,upload_torrent,"execute={upload,$d.get_base_path=}"
 

jith45

Member
May 25, 2018
960
0
16
The wrapper is used to prevent rtorrent from freezing/crashing during the upload process. During my tests I noticed that rtorrent froze while running the upload script. If it's a small torrent and a good server it shouldn't take long and probably won't crash rtorrent. However as said it will still freeze rtorrent, which is still crappy especially if you have a lot of auto upload torrents. If there's a huge torrent in there that you want to auto upload you might even freeze rtorrent so long that it crashes.
If the command using upload works fine I take it there's nothing wrong with the upload script itself, which is basically the only thing the wrapper does: call the upload script and make it run in the background.
Make sure the wrapper file is executable, and if you keep having problems you can add some debugging in there (i.e. echo a line "got here" or a variable to some file and check the output, or even (temporarily) remove the part which suppresses the errors and makes it run in the background ">/dev/null 2>&1 &" and check the rtorrent logfile for the output).
 

shwetha17

Member
May 24, 2018
785
0
16
Quote
The wrapper is used to prevent rtorrent from freezing/crashing during the upload process. During my tests I noticed that rtorrent froze while running the upload script. If it's a small torrent and a good server it shouldn't take long and probably won't crash rtorrent. However as said it will still freeze rtorrent, which is still crappy especially if you have a lot of auto upload torrents. If there's a huge torrent in there that you want to auto upload you might even freeze rtorrent so long that it crashes.
If the command using upload works fine I take it there's nothing wrong with the upload script itself, which is basically the only thing the wrapper does: call the upload script and make it run in the background.
Make sure the wrapper file is executable, and if you keep having problems you can add some debugging in there (i.e. echo a line "got here" or a variable to some file and check the output, or even (temporarily) remove the part which suppresses the errors and makes it run in the background ">/dev/null 2>&1 &" and check the rtorrent logfile for the output).​


Hi There,

The file is executable, but don't have permissions to access the sudoers file, everything run on the server is run under my username and wont ask for a password