user214723
user214723

Reputation: 21

rtorrent execute shell script

I can't figure out how to get output from shell script back to rtorrent after command has been executed. Is it possible to return back output from exeternal command back to rtorrent session? I use rtorrent scripting interface to auto execute shell command after torrent is finished event line in .rtorrent.rc looks like this:

system.method.set_key = event.download.finished,mycustomcommand,"execute=~/myshellscript.sh"

myshellscript.sh file looks like this

#!/bin/sh
echo "Torrent finished!"

Is there a way to do this?

Upvotes: 2

Views: 3890

Answers (4)

Ryan Morris
Ryan Morris

Reputation: 1

I had to add sh as the first argument before the path to your_script.sh.

Upvotes: 0

Merlincool
Merlincool

Reputation: 19

You forgot to add parameters to the rtorrent.rc itself and also the bash script is incomplete according to me.

.rtorrent.rc line should have

method.set_key = event.download.finished,whatever,"execute2={/path/myscript.sh,$d.name=,$d.base_path=,$d.hash=}"

bash script

#!/bin/bash
TORRENT_NAME=1
TORRENT_PATH=2
TORRENT_HASH=3

touch "$1" Finished download!

exit

this will create touch file telling you particular file has finished downloading.

Upvotes: 1

plitter
plitter

Reputation: 794

system.method.set_key = event.download.finished,mycustomcommand,print="$execute_capture=/path/to/script" 

should work, at least

print="$execute_capture=/path/to/script"

works when you do it inside rtorrent. If you want to store the output then intstead of print use d.custom1.set= if that helps.

Upvotes: 0

agocska
agocska

Reputation: 3

I'm not sure what you're searching for, but I found this on rtorrent's wiki site:

execute_capture_nothrow={command,arg1,arg2,...}

This will execute the external command with arguments arg1,arg2,.... It will return the stdout output of the command.

Upvotes: 0

Related Questions