CentOS系统安装Transmission和FlexGet全自动刷PT流量
|
![]() |
![]() |
![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |
手上有VPS的想刷PT的朋友可以看看,但是如果你的硬盘空间不到50G的话,很有可能会爆仓,今天给大家分享一个教程,可以自动刷PT流量的同时还可以自动删除种子。
Transmission安装
脚本:
wget http://github.itzmx.com/1265578519/transmission/master/2.84/transmissionbt.sh -O transmissionbt.shsh transmissionbt.sh| 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/
如需修改配置,需要先暂停服务,否则修改无效。
service transmissiond stopvi /home/transmission/.config/transmission/settings.json| 12 | service transmissiond stopvi /home/transmission/.config/transmission/settings.json |
rpc-username 帐号
rpc-password 密码
rpc-port 端口
rpc-authentication-required 是否开启使用账号密码加密访问
preallocation 需要设置为0,这是这个办法中不会爆盘的关键。
启动Transmission服务:
service transmissiond start| 1 | service transmissiond start |
如需卸载Transmission:
service transmissiond stoprm -rf /home/transmissionrm -rf /usr/share/transmission| 123 | service transmissiond stoprm -rf /home/transmissionrm -rf /usr/share/transmission |
FlexGet安装
这是一个扩展工具,可以令Transmission具备RSS下载的功能,其实也能自动删除种子(但是我的情况比较特殊,VPS硬盘比较小,用FlexGet的clean_transmission和free_space插件会有问题)。
安装编译环境:
yum install -y gcc make zlib zlib-devel readline-devel sqlite sqlite-devel openssl-devel mysql-devel gd-devel| 1 | yum install -y gcc make zlib zlib-devel readline-devel sqlite sqlite-devel openssl-devel mysql-devel gd-devel |
安装 Python(一般的VPS系统都自带,有能力自行修改后面代码的可以不安装):
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| 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:
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| 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:
/usr/local/bin/pip install virtualenvln -s /root/python/bin/virtualenv /usr/local/bin/virtualenv| 12 | /usr/local/bin/pip install virtualenvln -s /root/python/bin/virtualenv /usr/local/bin/virtualenv |
安装 FlexGet:
cd /root/virtualenv /root/flexget//root/flexget/bin/pip install flexget/root/flexget/bin/pip install transmissionrpc| 1234 | cd /root/virtualenv /root/flexget//root/flexget/bin/pip install flexget/root/flexget/bin/pip install transmissionrpc |
添加FlexGet配置文件:
vi /root/flexget/config.yml| 1 | vi /root/flexget/config.yml |
配置文件示例:
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| 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两个插件的配置,附在上面的配置后面即可。
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| 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下载的目录:
mkdir /home/transmission/torrent| 1 | mkdir /home/transmission/torrent |
执行FlexGet:
/root/flexget/bin/flexget -c /root/flexget/config.yml execute| 1 | /root/flexget/bin/flexget -c /root/flexget/config.yml execute |
可以添加一个定时任务:
crontab -e| 1 | crontab -e |
在其中加入:
*/5 * * * * /root/flexget/bin/flexget -c /root/flexget/config.yml execute| 1 | */5 * * * * /root/flexget/bin/flexget -c /root/flexget/config.yml execute |
意思是,每5分钟执行一次。
自动清理种子脚本
自动清理种子的任务我交给了另外一个脚本来执行。
新建脚本文件:
vi /root/trans_cleanup.sh| 1 | vi /root/trans_cleanup.sh |
脚本文件内容:
#! /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_check if [ "$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 donefi if [ "$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 donefi if [ "$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 donefi if [ "$DISK_OVER" = "1" ];then rm -rf $DLDIR1 * * * * /bin/bash /root/trans_cleanup.sh| 1 | */1 * * * * /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防火墙的问题,关闭即可。
#停止firewallsystemctl stop firewalld.service#禁止firewall开机启动systemctl disable firewalld.service| 1234 | #停止firewallsystemctl stop firewalld.service#禁止firewall开机启动systemctl disable firewalld.service |
猜你可能想看的VPS
- 天上云:香港CN2弹性云服务器;1核/1G/20G/;促销月付24元起( 香港VPS[主机]
- 2023年 IDC市场结构和方向的深度分析 全球[VPS测评]
- 游戏服务器是什么意思?游戏服务器可以用云服务器吗? 全球[VPS测评]
- 百看不厌的文案,抖音唯美文案。 全球[VPS测评]
- 拼多多回应筹备跨境电商业务:不予置评 全球[VPS测评]
- CIO和其他IT领导者充分利用边缘计算增强业务的4个关键 全球[VPS测评]
- 华凯易佰同比扭亏跨境电商行业回暖H2旺季将至中报追踪 全球[VPS测评]
- 戈登云VPS,6折,充值送50%,香港cn2,美国cn云服务器,2核2G 美国VPS[主机]
- 磐逸云怎么样?CN2线路香港VPS月付20元 香港VPS[主机]
- UCloud香港云主机怎么样?UCloud香港云主机1核1G1M评测 香港VPS[主机]
- 六一云:国内BGP高防vps套餐,1核/1G/2Mbps/香港CN2,月 香港VPS[主机]
- 月神云:洛杉矶CN2 GIA高防vps、香港CN2 GIA VPS全场7 香港VPS[主机]
- 恒创科技:香港免备案CN2线路VPS/美国CN2直连VPS,月付28元起 美国VPS[主机]
- ucloud香港服务器怎么样?听听这些网友们怎么说的 香港VPS[主机]
- hosthatch:香港/芝加哥/伦敦等11机房VPS低至$17.5/年 香港VPS[主机]
- 弘速科技:香港安畅CN2 GIA/弹性云服务器10元/月,2核1GB/2 香港VPS[主机]
- TabbyCloud:1核/1GB/20GB/2TB流量/50Mbps/ 香港VPS[主机]
- edgeNAT:便宜美国CN2/香港CN2/韩国CN2低至48元/月_不 韩国VPS[主机]
- tmhhost:香港安畅机房三网CN2 GIA VPS,月付45起;美国 美国VPS[主机]
- 特网云:香港云服务器新上线,香港新界机房;1核/1G/5M宽带/50G硬 香港VPS[主机]
- 糖果主机(sugarhosts):春季优惠,云服务器/云vps/虚拟主机 全球[VPS测评]
- 阳帝云:3月优惠活动,香港GIA/香港TG/洛杉矶200G硬防vps,首 香港VPS[主机]
- 特网云:高防香港云主机/CN2/真实防御/30G高防御/金盾防护无视CC 香港VPS[主机]
- 2022年亚马逊Prime会员日将于7月12日和13日举行,覆盖24个站 全球[VPS测评]
- 消费复苏形势良好,我们将多措并举实施扩大内需政策 全球[VPS测评]
- 从阿里云七代云服务器,谈云计算四大趋势 全球[VPS测评]
- 如何设置必应api 自动推送网站 全球[VPS测评]
- 拼多多拟建跨境电商平台:挖角SHEIN员工,0佣金招商入驻 全球[VPS测评]
- 磐逸云怎么样?香港沙田cn2vps 带宽5M年付128元 香港VPS[主机]
- 极光KVM:美国香港vps CN2 GIA专线高速稳定,BGP服务器低至 美国VPS[主机]
转载请注明原文地址: http://140.238.13.167:12355/read-24686.html











