Aria2 下载自动上传阿里云盘

请先将阿里云盘webdav挂在到本地,可以按照下面的教程来进行

将阿里云盘挂载为Webdav并使用rclone挂载到本地

安装aria2

执行下面的代码下载并运行脚本:

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/aria2.sh && chmod +x aria2.sh && bash aria2.sh
#备用地址
wget -N --no-check-certificate https://www.moerats.com/usr/shell/Aria2/aria2.sh && chmod +x aria2.sh && bash aria2.sh

运行脚本后会出现脚本操作菜单,选择并输入1就会开始安装。

使用说明

进入下载脚本的目录并运行脚本:

./aria2.sh

然后选择你要执行的选项即可。

Aria2 一键安装管理脚本 [vx.x.x]
-- Toyo | doub.io/shell-jc4 --
 
0. 升级脚本
————————————
1. 安装 Aria2
2. 卸载 Aria2
————————————
3. 启动 Aria2
4. 停止 Aria2
5. 重启 Aria2
————————————
6. 修改 配置文件
7. 查看 日志信息
————————————
 
当前状态: 已安装 并 已启动
 
请输入数字 [0-7]:

其他操作

启动:service aria2 start 停止:service aria2 stop 重启:service aria2 restart 查看状态:service aria2 status 配置文件:/root/.aria2/aria2.conf(配置文件包含中文注释,但是一些系统可能不支持显示中文) 下载目录:/usr/local/caddy/www/aria2/Download(该目录为Github下载安装的,而备用地址下载的默认为/usr/local/caddy/www/file

安装完成之后可以自行搭建前端或是使用我的前端http://aria2ng.southcat.net进行连接aria2 默认密码为doub.io

添加自动上传

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

#!/bin/bash

GID="$1";
FileNum="$2";
File="$3";
MinSize="5"  #限制最低上传大小,默认5k
MaxSize="157286400"  #限制最高文件大小(单位k),默认15G
RemoteDIR="/aliyun/";  #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生效。

 

技术分享

将阿里云盘挂载为Webdav并使用rclone挂载到本地

2022-1-5 20:01:52

技术分享

VPS挂载阿里云盘-Aria2下载后自动转存阿里云盘

2022-1-10 19:11:51

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索

Warning: error_log(/www/wwwroot/www.yuns.top/wp-content/plugins/spider-analyser/#log/log-1920.txt): failed to open stream: Permission denied in /www/wwwroot/www.yuns.top/wp-content/plugins/spider-analyser/spider.class.php on line 2900