惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

Rat's Blog - vps

SpartanHost:512MB内存/10GB硬盘/1T流量/DDoS防御/KVM/西雅图/最低月付$2 - Rat's Blog 一个去中心化的图片分享平台:ipfs.pics搭建教程 - Rat's Blog Linux VPS一键更换软件源脚本 - Rat's Blog Flask+WebUploader实现快速将本地文件上传到VPS服务器 - Rat's Blog Linux VPS一键安装桌面环境和RDP远程桌面连接 - Rat's Blog Kvmla:1G内存/40G硬盘/600G流量/日本&香港&新加坡KVM/月付¥80 - Rat's Blog 新型功能强大的VPS虚拟主机控制面板:BrainyCP安装教程 - Rat's Blog VPS服务器如何优化/加快网站的访问速度 - Rat's Blog loader工具转换成Debian 9系统 - Rat's Blog
使用Aira2下载文件后自动上传到Google Drive网盘 - Rat's Blog
博主: Rat's · 2018-10-30 · via Rat's Blog - vps

说明:网盘挂载方法参考:在Debian/Ubuntu上使用rclone挂载Google Drive网盘Aira2安装参考:BT种子/磁力链接下载工具:Aria2一键安装管理脚本,以上工作都准备好了后,就可以使用Aria2将文件电影等资源下载到网盘了,鉴于hostloc有大佬说因为某些原因,不能将下载路径默认为Google Drive网盘指定的本地文件夹,就发现了这个方法,能直接在挂载后使用。通过配置项on-download-complete来完成下载文件自动移到Google Drive网盘里。

更新

【2018.10.30】
这里分享下萌咖大佬的Aira2上传脚本,不过是精简版,全能版暂不分享,精简版包含以下功能:
1、脚本适用于Rclone挂载的网盘,比如Onedrive/Google Drive等。
2、判断上传文件的文件大小区间。
限制最低上传大小:可防止产生的.aria2后缀文件一起上传到网盘。
限制最高文件大小:适用于Onedrive等,官方限制上传不能超过15G,其它可自行更改其数值。
3、支持文件名中包含空格等特殊字符。

使用方法

原理是当下载完后aria2会给脚本传3个参数$1$2$3分别为gid、文件数量、文件路径。我们对文件路径这个字符串处理一番就可以达到目的了。

新建脚本文件rcloneupload.sh,并复制下面代码:

#!/bin/bash

GID="$1";
FileNum="$2";
File="$3";
MinSize="5"  #限制最低上传大小,默认5k
MaxSize="157286400"  #限制最高文件大小(单位k),默认15G
RemoteDIR="/RATS/";  #rclone挂载的本地文件夹,最后面保留/
LocalDIR="/download/";  #Aria2下载目录,最后面保留/

if [[ -z $(echo "$FileNum" |grep -o '[0-9]*' |head -n1) ]]; then FileNum='0'; fi
if [[ "$FileNum" -le '0' ]]; then exit 0; fi
if [[ "$#" != '3' ]]; then exit 0; fi

function LoadFile(){
  IFS_BAK=$IFS
  IFS=$'\n'
  if [[ ! -d "$LocalDIR" ]]; then return; fi
  if [[ -e "$File" ]]; then
    FileLoad="${File/#$LocalDIR}"
    while true
      do
        if [[ "$FileLoad" == '/' ]]; then return; fi
        echo "$FileLoad" |grep -q '/';
        if [[ "$?" == "0" ]]; then
          FileLoad=$(dirname "$FileLoad");
        else
          break;
        fi;
      done;
    if [[ "$FileLoad" == "$LocalDIR" ]]; then return; fi
    EXEC="$(command -v mv)"
    if [[ -z "$EXEC" ]]; then return; fi
    Option=" -f";
    cd "$LocalDIR";
    if [[ -e "$FileLoad" ]]; then
      ItemSize=$(du -s "$FileLoad" |cut -f1 |grep -o '[0-9]*' |head -n1)
      if [[ -z "$ItemSize" ]]; then return; fi
      if [[ "$ItemSize" -le "$MinSize" ]]; then
        echo -ne "\033[33m$FileLoad \033[0mtoo small to spik.\n";
        return;
      fi
      if [[ "$ItemSize" -ge "$MaxSize" ]]; then
        echo -ne "\033[33m$FileLoad \033[0mtoo large to spik.\n";
        return;
      fi
      eval "${EXEC}${Option}" \'"${FileLoad}"\' "${RemoteDIR}";
    fi
  fi
  IFS=$IFS_BAK
}
LoadFile;

授权chmod +x rcloneupload.sh,然后再到Aria2配置文件中加上一行on-download-complete=/root/rcloneupload.sh即可,后面为脚本的路径。最后重启Aria2生效。

本文只提到了Google Drive网盘挂载方法,如果你想用Onedrive可查看→Rclone挂载Onedrive网盘教程。对于不想用Rclone挂载Onedrive的,可以参考博客另一个教程→传送门


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/482/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。