我正在使用 ruby 脚本下载比特币 bootstrap.dat 文件,该文件只能使用 torrent 客户端下载,因此要在命令行上下载,我使用以下 ruby 演示脚本:
#!/usr/bin/ruby env
`transmission-cli https://bitcoin.org/bin/blockchain/bootstrap.dat.torrent`
现在我运行该脚本
root@master:~# ruby demo
但是该脚本挂起,因为上面的传输完美地下载了种子文件,但之后它开始播种和上传并且永远不会自动终止,有什么方法可以使用我的脚本终止它吗?
有什么方法可以让我在 torrent 下载完成后发送终止或终止信号吗?
您可以使用
-f, -finish <script>
下载完成后执行脚本:
tmpfile=$(mktemp)
chmod a+x $tmpfile
echo "killall transmission-cli" > $tmpfile
transmission-cli -f $tmpfile your.torrent
rtorrent
,它有更多选项。
谢谢您的脚本,我的设置是这样的:
tmpfile=$(mktemp)
chmod a+x $tmpfile
echo "killall transmission-cli" > $tmpfile
transmission-cli -f $tmpfile "$(xclip -o -
selection clipboard)"
我如何添加这样的通知声音:
paplay /usr/share/sounds/freedesktop/stereo/complete.oga
那么完成后它就会熄灭吗?只是问一下,我不是编码员或脚本编写者,我只是主要复制和粘贴我的脚本。
没关系,我想通了,我是这样设置的:
tmpfile=$(mktemp) chmod a+x $tmpfile 回声“paplay” /usr/share/sounds/freedesktop/stereo/complete.oga && Killall Transmission-cli" > $tmpfile Transmission-cli -f $tmpfile "$(xclip -o - 选择剪贴板)”