rtorrent执行shell脚本

时间:2013-11-11 19:26:56

标签: bash shell libtorrent

我无法弄清楚如何在执行命令后将shell脚本的输出返回到rtorrent。 是否有可能将输出从exeternal命令返回到rtorrent会话? 在torrent完成后,我使用rtorrent脚本界面自动执行shell命令 .rtorrent.rc中的事件行如下所示:

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

myshellscript.sh文件看起来像这样

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

有办法做到这一点吗?

3 个答案:

答案 0 :(得分:0)

我不确定你在搜索什么,但我在rtorrent's wiki site找到了这个:

  

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

     

这将使用参数arg1,arg2,....执行外部命令。它将返回   stdout输出命令。

答案 1 :(得分:0)

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

应该起作用,至少

print="$execute_capture=/path/to/script"
当你在rtorrent里面做的时候,

会起作用。如果你想存储输出,那么在不使用打印的情况下使用d.custom1.set =如果有帮助的话。

答案 2 :(得分:0)

你忘记给rtorrent.rc本身添加参数,而且bash脚本据我说是不完整的。

.rtorrent.rc 行应该有

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

bash 脚本

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

touch "$1" Finished download!

exit

这将创建触摸文件,告诉您特定文件已完成下载。