CentOS 系统安装 Transmission 和 FlexGet 全自动刷 PT 流量
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

手上有 VPS 的想刷 PT 的朋友可以看看,但是如果你的硬盘空间不到 50G 的话,很有可能会爆仓,今天给大家分享一个教程,可以自动刷 PT 流量的同时还可以自动删除种子。
Transmission 安装脚本:
| 12 | wget http://github.itzmx.com/1265578519/transmission/master/2.84/transmissionbt.sh -O transmissionbt.shsh transmissionbt.sh |
访问地址为 http://IP:9091,默认用户名和密码均为 itzmx.com,文件下载位置:/home/transmission/Downloads/
如需修改配置,需要先暂停服务,否则修改无效。
| 12 | service transmissiond stopvi /home/transmission/.config/transmission/settings.json |
rpc-username 帐号
rpc-password 密码
rpc-port 端口
rpc-authentication-required 是否开启使用账号密码加密访问
preallocation 需要设置为 0,这是这个办法中不会爆盘的关键。
启动 Transmission 服务:
| 1 | service transmissiond start |
如需卸载 Transmission:
| 123 | service transmissiond stoprm -rf /home/transmissionrm -rf /usr/share/transmission |
这是一个扩展工具,可以令 Transmission 具备 RSS 下载的功能,其实也能自动删除种子(但是我的情况比较特殊,VPS 硬盘比较小,用 FlexGet 的 clean_transmission 和 free_space 插件会有问题)。
安装编译环境:
| 1 | yum install -y gcc make zlib zlib-devel readline-devel sqlite sqlite-devel openssl-devel mysql-devel gd-devel |
安装 Python(一般的 VPS 系统都自带,有能力自行修改后面代码的可以不安装):
| 123456789 | wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgztar zxf Python-2.7.13.tgzpushd Python-2.7.13./configure--pix=/root/python&&make&&make install&&ln -s /root/python/bin/python2.7 /usr/local/bin/pythonsource ~/.bash_profilepopd |
安装 pip:
| 123 | wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate/usr/local/bin/python get-pip.pyln -s /root/python/bin/pip /usr/local/bin/pip |
安装 virtualenv:
| 12 | /usr/local/bin/pip install virtualenvln -s /root/python/bin/virtualenv /usr/local/bin/virtualenv |
安装 FlexGet:
| 1234 | cd /root/virtualenv /root/flexget//root/flexget/bin/pip install flexget/root/flexget/bin/pip install transmissionrpc |
添加 FlexGet 配置文件:
| 1 | vi /root/flexget/config.yml |
配置文件示例:
| 12345678910111213 | tasks: mt: rss: https://tp.m-team.cc/torrentrss.php?https=1&rows=10&cat410=1&cat429=1&cat424=1&cat430=1&icat=1&isize=1&iuplder=1&linktype=dl&passkey=***** accept_all: yes content_size: min: 256 max: 3072 download: /home/transmission/torrent transmission: host: 127.0.0.1 port: 9091 username: user password: password |
这个示例是我看到的教程中给的,其原文还给了 clean_transmission 和 free_space 两个插件的配置,附在上面的配置后面即可。
| 1234567891011 | clean_transmission: host: 127.0.0.1 port: 9091 username: user password: password finished_for: 6 hours tracker: tp.m-team.cc delete_files: Yes free_space: path: /home/transmission/Downloads space: 3072 |
但是我并没有使用这两个插件,原作者可能没有我这样小硬盘的 VPS。这两个插件的意思是,种子下载完成以后 6 个小时自动删除,当硬盘剩余空间小于 3G 时,不再自动添加种子。但是我的使用中,当剩余空间不足 3G 时,确实不会添加新的种子了,但是这个时候“6 小时自动删除”的设置却也无效了,因为 free_space 的优先级很高,检测到空间不足时,就会退出任务,clean_transmission 插件的任务不再执行了。所以用这个办法还是得偶尔查看一下 Transmission,当然如果你的硬盘足够大,应该是不需要考虑这个问题的,这个配置可以使用。
注意:使用这个的话,Transmission 的 preallocation 需要设置为 1。
先创建 torrent 下载的目录:
| 1 | mkdir /home/transmission/torrent |
执行 FlexGet:
| 1 | /root/flexget/bin/flexget -c /root/flexget/config.yml execute |
可以添加一个定时任务:
| 1 | crontab -e |
在其中加入:
| 1 | */5 * * * * /root/flexget/bin/flexget -c /root/flexget/config.yml execute |
意思是,每 5 分钟执行一次。
自动清理种子脚本自动清理种子的任务我交给了另外一个脚本来执行。
新建脚本文件:
| 1 | vi /root/trans_cleanup.sh |
脚本文件内容:
| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | #! /bin/bash#====================================================================# trans_cleanup.sh## Copyright (c) 2011, WangYan <webmaster@wangyan.org># All rights reserved.# Distributed under the GNU General Public License, version 3.0.## Monitor disk space, If the Over, delete some files.## See: http://wangyan.org/blog/trans_cleanup.html## V0.2, since 2012-10-29#====================================================================# The transmission remote login usernameUSERNAME="username"# The transmission remote login passwordPASSWORD="password"# The transmission download dirDLDIR="/home/transmission/Downloads"# The maximum allowed disk (%)DISK_USED_MAX="90"# Enable auto shutdown support (Disable=0, Enable=1)ENABLE_AUTO_SHUTDOWN="0"# Log path settingsLOG_PATH="/var/log/trans_cleanup.log"# Date time format settingDATA_TIME=$(date +"%y-%m-%d %H:%M:%S")#====================================================================dist_check(){ DISK_USED=`df -h $DLDIR | grep -v Mounted | awk '{print $5}' | cut -d '%' -f 1` DISK_OVER=`awk 'BEGIN{print('$DISK_USED'>'$DISK_USED_MAX')}'`}dist_checkif [ "$DISK_OVER" = "1" ];then for i in `transmission-remote --auth $USERNAME:$PASSWORD -l | grep 100% | grep Done | awk '{print $1}' | grep -v ID` do [ "$i" -gt "0" ] && echo -n "$DATA_TIME [Done] " >> $LOG_PATH transmission-remote --auth $USERNAME:$PASSWORD -t $i --remove-and-delete >> $LOG_PATH 2>&1 [ "$i" -gt "0" ] && sleep 10 && dist_check [ "$DISK_OVER" = "0" ] && break donefiif [ "$DISK_OVER" = "1" ];then for ii in `transmission-remote --auth $USERNAME:$PASSWORD -l | grep Stopped | awk '{print $1}' | grep -v ID` do [ "$ii" -gt "0" ] && echo -n "$DATA_TIME [Stopped] " >> $LOG_PATH transmission-remote --auth $USERNAME:$PASSWORD -t $ii --remove-and-delete >> $LOG_PATH 2>&1 [ "$ii" -gt "0" ] && sleep 10 && dist_check [ "$DISK_OVER" = "0" ] && break donefiif [ "$DISK_OVER" = "1" ];then for iii in `transmission-remote --auth $USERNAME:$PASSWORD -l | grep -v Sum | awk '{print $1}' | grep -v ID` do [ "$iii" -gt "0" ] && echo -n "$DATA_TIME [Up or Down] " >> $LOG_PATH transmission-remote --auth $USERNAME:$PASSWORD -t $iii --remove-and-delete >> $LOG_PATH 2>&1 [ "$iii" -gt "0" ] && sleep 10 && dist_check [ "$DISK_OVER" = "0" ] && break donefiif [ "$DISK_OVER" = "1" ];then rm -rf $DLDIR1 * * * * /bin/bash /root/trans_cleanup.sh |
每分钟执行一次。
注意事项1、因为 Transmission 下载时,没有预分配磁盘空间,因此硬盘是一点一点占用的,只要达到了设置的阈值(比如 90%),这个脚本就会清理已经完成的种子,如果空间还不够,就会清理正在下载的种子。因为脚本是每分钟执行的,所以没有硬盘塞满的风险。
2、硬盘总空间太小,就会经常需要删除旧的种子,这样一个种子的分享率可能就不高,长久下来,PT 网站的总分享率也就不高了,可以通过调节接收种子的最大体积来影响(FlexGet 配置文件中的 3072 表示最大接受 3G 的种子,超过就会被过滤,不会添加到 Transmission 中)。
3、Debian 和 Ubuntu 应该也是可以使用的,只需要自己安装好 Transmission 和 FlexGet 就行。
4、如果重启后,transmission web ui 无法连接,可能是 centos 默认的 firewall 防火墙的问题,关闭即可。
| 1234 | #停止 firewallsystemctl stop firewalld.service#禁止 firewall 开机启动systemctl disable firewalld.service |
猜你可能想看的VPS
- 双十一 嘟牛云→香港机房套餐尊享 75 折优惠 免费内存翻倍 充值返额 香港VPS[主机]
- 锐速 BBR 魔改 BBR 效果对比 锐速和 BBR 选择哪个好全球[VPS测评]
- 美尔联→31 元 月 1GB 内存 20GB SSD 空间 200GB 虚拟空间(主机)
- RAKsmart 双旦活动→圣何塞服务器 46 美元 香港服务器 122美国VPS[主机]
- Chrome 浏览器开发者工具中引入网络 js 文件进行测试的方法全球[VPS测评]
- 利用 google voice 开启微信隐藏电话功能 WeChat Ou全球[VPS测评]
- Online - Summer Deals Start-2-S 系列 月全球[VPS测评]
- DiyVM→69 元 月 XEN-2GB 50GB 2M 香港&洛杉矶香港VPS[主机]
- hostsolutions→€76 年 罗马尼亚大硬盘 VPS 无视版权全球[VPS测评]
- element-ui upload 清空文件列表全球[VPS测评]
- 搬瓦工 DC9(CN2 GIA)补货 年付 37.8 美元 支持支付宝全球[VPS测评]
- Virtono - 春季特价促销 VPS 最低二八折年付€9.95全球[VPS测评]
- 如何注册解析.tk,.ml,.ga,.cf,.gq等免费域名全球[VPS测评]
- Hostodo 亚洲优化线路512MB内存8gNVME硬盘 3T大流量 全球[VPS测评]
- WordPress如何代码实现完全禁用REST API全球[VPS测评]
- HostyHub-13$ 月 印度 独立IP KVM VPS 4核4G内独立服务器[U]
- Wikihost CN2 香港虚拟主机 → 8折终身优惠码香港VPS[主机]
- 修罗云上海CN2 NAT → 1核 512M内存 6G硬盘 单向1T 7全球[VPS测评]
- btcvps,比特云怎么样?香港VPS,KVM架构带宽4M月付88港币香港VPS[主机]
- 云服务器都是有哪些特点?全球[VPS测评]
- 云计算的三种服务模式,SaaS和PaaS的区别在哪里?全球[VPS测评]
- 六六云,2核2G香港云服务器/1000GB流量/50Mbps端口/KVM香港VPS[主机]
- 桔子数据,香港安畅BGP大带宽VPS 首月五折体验 三网直连 14元/月香港VPS[主机]
- 野草云服务器怎么样?香港CN2+BGP带宽30M月付19元香港VPS[主机]
- 彗星云:香港特价vps1核/1G/无限流量/月付仅9元,年付仅75元;国香港VPS[主机]
- 安国云:1核/1G/20G硬盘/1Mbp不限流量/香港cdia,月付18香港VPS[主机]
- YYYHost:4核4G香港cn2vps,20G SSD/3Mbps不限香港VPS[主机]
- 特网云:香港高防CN2云服务器,新加坡/美国/洛杉矶/英国/荷兰等,5M美国VPS[主机]
- 六一云:国内BGP高防vps套餐,1核/1G/2Mbps/香港CN2,月香港VPS[主机]
- 长三角地区的算力需求规模到底有多大?全球[VPS测评]
转载请注明原文地址:http://140.238.13.167:12355/read-206085.html











