document.writeln('');

在公车被猛烈进入爽文,啊灬轻点大JI巴太粗又长A片,亚洲色欲AV成人无码久久精品 ,国产大片内射1区2区,久久久网址,亚洲一区二区三区免费视频,精品欧美一区二区三区久久久,久久国产精品-久久精品

當前位置:首頁 > 免費源碼 > Aria2+Rclone配合OneDrive、Google Drive等網盤實現離線下載

Aria2+Rclone配合OneDrive、Google Drive等網盤實現離線下載

游戲科技網2026年09月14日 22:00免費源碼70

Aria2簡介

Aria2 完美配置是一套 Aria2 配置方案,包含了配置文件、附加功能腳本等文件,用于實現 Aria2 功能的增強和擴展,提升 Aria2 的下載速度與使用體驗,解決 Aria2 在使用中遇到的 BT 下載無速度、文件殘留占用磁盤空間、任務丟失、重復下載等問題。

功能特性

  • BT下載率高、速度快
  • 重啟后不丟失任務進度、不重復下載
  • 下載錯誤或取消下載自動刪除未完成的文件防止磁盤空間占用
  • 下載完成自動清除.aria2后綴名文件
  • 一鍵獲取BT tracker,進一步提升BT下載速度
  • 更好的PT下載支持
  • 有一定的防版權投訴、防迅雷吸血效果
  • 聯動RCLONE自動上傳到Google Drive和OneDrive等網盤

Aria2部署

1)Aria2 一鍵安裝,系統要求CentOS 6+ / Debian 6+ / Ubuntu 14.04+,以 Debian 為例子,安裝命令如下:

為了確保能正常使用,請先安裝基礎組件wget、curl、ca-certificates,以 Debian/centos為例子:

<span class="hljs-attribute">apt</span> install wget curl ca-certificates <span class="hljs-comment">#debian</span>
yum install wget curl ca-certificates <span class="hljs-comment">#centos</span>
<span class="hljs-attribute">apt</span> install wget curl ca-certificates  <span class="hljs-comment">#debian</span>
yum install wget curl ca-certificates <span class="hljs-comment">#centos</span>
apt install wget curl ca-certificates#debianyum install wget curl ca-certificates #centos

2)下載腳本

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
wget -N git.io/aria2.sh && chmod +x aria2.sh

Aria2項目GITHUB:

 

3)運行腳本

./aria2.sh
./aria2.sh
./aria2.sh

4)選擇你要執行的選項,選擇對應的安裝選項。

Aria2 一鍵安裝管理腳本 增強版 [v2<span class="hljs-number">.7</span><span class="hljs-number">.4</span>] <span class="hljs-keyword">by</span> P3TERX.COM
<span class="hljs-number">0.</span> 升級腳本
———————————————————————
<span class="hljs-number">1.</span> 安裝 Aria2
<span class="hljs-number">2.</span> 更新 Aria2
<span class="hljs-number">3.</span> 卸載 Aria2
———————————————————————
<span class="hljs-number">4.</span> 啟動 Aria2
<span class="hljs-number">5.</span> 停止 Aria2
<span class="hljs-number">6.</span> 重啟 Aria2
———————————————————————
<span class="hljs-number">7.</span> 修改 配置
<span class="hljs-number">8.</span> 查看 配置
<span class="hljs-number">9.</span> 查看 日志
<span class="hljs-number">10.</span> 清空 日志
———————————————————————
<span class="hljs-number">11.</span> 手動更新 BT-Tracker
<span class="hljs-number">12.</span> 自動更新 BT-Tracker
———————————————————————
Aria2 狀態: 已安裝 | 已啟動
自動更新 BT-Tracker: 已開啟
請輸入數字 [<span class="hljs-number">0</span><span class="hljs-number">-12</span>]:
Aria2 一鍵安裝管理腳本 增強版 [v2<span class="hljs-number">.7</span><span class="hljs-number">.4</span>] <span class="hljs-keyword">by</span> P3TERX.COM
 
  <span class="hljs-number">0.</span> 升級腳本
 ———————————————————————
  <span class="hljs-number">1.</span> 安裝 Aria2
  <span class="hljs-number">2.</span> 更新 Aria2
  <span class="hljs-number">3.</span> 卸載 Aria2
 ———————————————————————
  <span class="hljs-number">4.</span> 啟動 Aria2
  <span class="hljs-number">5.</span> 停止 Aria2
  <span class="hljs-number">6.</span> 重啟 Aria2
 ———————————————————————
  <span class="hljs-number">7.</span> 修改 配置
  <span class="hljs-number">8.</span> 查看 配置
  <span class="hljs-number">9.</span> 查看 日志
 <span class="hljs-number">10.</span> 清空 日志
 ———————————————————————
 <span class="hljs-number">11.</span> 手動更新 BT-Tracker
 <span class="hljs-number">12.</span> 自動更新 BT-Tracker
 ———————————————————————
 
 Aria2 狀態: 已安裝 | 已啟動
 
 自動更新 BT-Tracker: 已開啟
 
 請輸入數字 [<span class="hljs-number">0</span><span class="hljs-number">-12</span>]:
Aria2 一鍵安裝管理腳本 增強版 [v2.7.4] by P3TERX.COM0. 升級腳本 ———————————————————————1. 安裝 Aria22. 更新 Aria23. 卸載 Aria2 ———————————————————————4. 啟動 Aria25. 停止 Aria26. 重啟 Aria2 ———————————————————————7. 修改 配置8. 查看 配置9. 查看 日志 10. 清空 日志 ——————————————————————— 11. 手動更新 BT-Tracker 12. 自動更新 BT-Tracker ———————————————————————Aria2 狀態: 已安裝 | 已啟動自動更新 BT-Tracker: 已開啟請輸入數字 [0-12]:

5)安裝完成后,Aria2 一鍵安裝管理腳本會顯示你的配置信息,把這些信息記下來。

Aria2 簡單配置信息:
IPv4 地址 : <span class="hljs-emphasis">*.*</span>.<span class="hljs-emphasis">*.*</span>
IPv6 地址 : IPv6 地址檢測失敗
RPC 端口 : 6800
RPC 密鑰 : 122sd1111123456df42
下載目錄 : /root/downloads
AriaNg 鏈接 : http://ariang.js.org/#!/settings/rpc/set/ws/<span class="hljs-emphasis">*.*</span>.<span class="hljs-emphasis">*.*</span>/6800/jsonrpc/ZjFdfkdikDAmNDI=
Aria2 簡單配置信息:

 IPv4 地址      : <span class="hljs-emphasis">*.*</span>.<span class="hljs-emphasis">*.*</span>
 IPv6 地址      : IPv6 地址檢測失敗
 RPC 端口       : 6800
 RPC 密鑰       : 122sd1111123456df42
 下載目錄       : /root/downloads
 AriaNg 鏈接    : http://ariang.js.org/#!/settings/rpc/set/ws/<span class="hljs-emphasis">*.*</span>.<span class="hljs-emphasis">*.*</span>/6800/jsonrpc/ZjFdfkdikDAmNDI=
Aria2 簡單配置信息: IPv4 地址: *.*.*.* IPv6 地址: IPv6 地址檢測失敗 RPC 端口: 6800 RPC 密鑰: 122sd1111123456df42 下載目錄: /root/downloads AriaNg 鏈接: http://ariang.js.org/#!/settings/rpc/set/ws/*.*.*.*/6800/jsonrpc/ZjFdfkdikDAmNDI=

Aria2簡單使用

Aria2 默認已經自帶了Aria2NG了,打開:http://ariang.js.org/#xxxx那一串地址,就可以進入Aria2 離線下載界面了。

  • 如果顯示一直不能連接,在寶塔安全放行6800端口,就可以成功了連接~
  • 可以添加一個下載任務,就能看到Aria2 離線下載進度了。
  • Aria2 離線下載最大的速度取決你的VPS主機的帶寬,主機商不會讓你長期占滿帶寬。
  • 如果你發現離線下載BT沒有速度,請打開Aria2自動更新種子功能。

Aria2 基本操作命令

  • 啟動:/etc/init.d/aria2 start | service aria2 start
  • 停止:/etc/init.d/aria2 stop | service aria2 stop
  • 重啟:/etc/init.d/aria2 restart | service aria2 restart
  • 查看狀態:/etc/init.d/aria2 status | service aria2 status
  • 配置文件路徑:/root/.aria2c/aria2.conf (配置文件有中文注釋,若語言設置有問題會導致中文亂碼)
  • 默認下載目錄:/root/downloads
  • RPC 密鑰:隨機生成,可使用選項7. 修改 配置文件自定義

Aria2配置文件說明

TIPS: 腳本需配合配置文件使用,僅適用于 GNU/?Linux

文件說明
aria2.confAria2 配置文件。僅適用于 Aria2 1.35.0 及以上版本,在不了解的情況下修改可能導致本方案的特性失效。
delete.sh文件刪除腳本。在下載停止后執行(on-download-stop),自動刪除文件及 .aria2 后綴名文件,防止不必要的磁盤空間占用。(默認啟用)
clean.sh清理腳本。在下載完成后執行(on-download-complete),自動清除 .aria2 后綴名文件。(默認啟用)
upload.sh上傳腳本。在下載完成后執行(on-download-complete),自動調用 RCLONE 上傳(move)下載的文件到網盤,并自動清除 .aria2 后綴名文件與空目錄。(默認不啟用)
move.sh文件移動腳本。在下載完成后執行(on-download-complete),自動將下載完成的文件移動到指定目錄,并自動清除 .aria2 后綴名文件與空目錄。(默認不啟用)
tracker.shBT tracker 列表更新腳本。在 Aria2 配置文件(aria2.conf)所在目錄執行即可獲取最新 tracker 列表并添加到配置文件中。此腳本還有更強大的功能,具體使用方法詳見 tracker.md
dht.dat
dht6.dat
DHT 文件。提升 BT 下載率和下載速度的關鍵之一。相關科普:《解決 Aria2 無法下載磁力鏈接、BT種子和速度慢的問題》

配置自動上傳腳本

Aria2 一鍵安裝管理腳本 增強版 整合了 Aria2 完美配置 ,安裝后會附帶一些附加功能腳本功能腳本,RCLONE 自動上傳腳本就是其中之一。由于默認不啟用,所以需要手動啟用。

TIPS: 本項目的上傳腳本使用更穩定快速的原生命令上傳方式,而非處在測試階段的掛載方式,這點和一般的腳本不同。
輸入以下命令打開 Aria2 配置文件進行修改

nano <span class="hljs-regexp">/root/</span>.aria2c/aria2.conf
nano <span class="hljs-regexp">/root/</span>.aria2c/aria2.conf
nano /root/.aria2c/aria2.conf

或使用Aria2 一鍵安裝管理腳本 增強版中的手動修改選項打開配置文件進行修改。找到“下載完成后執行的命令”,把clean.sh替換為upload.sh。

下載完成后執行的命令

<span class="hljs-literal">on</span>-download-complete=<span class="hljs-regexp">/root/</span>.aria2c/upload.sh
<span class="hljs-literal">on</span>-download-complete=<span class="hljs-regexp">/root/</span>.aria2c/upload.sh
on-download-complete=/root/.aria2c/upload.sh

nano 編輯器的操作方法參見《Linux 下適合新手的文本編輯器 nano 使用教程》
輸入以下命令打開附加功能腳本配置文件進行修改

nano <span class="hljs-regexp">/root/</span>.aria2c/script.conf
nano <span class="hljs-regexp">/root/</span>.aria2c/script.conf
nano /root/.aria2c/script.conf

有中文注釋,按照自己的實際情況進行修改,第一次使用只建議修改網盤名稱。

網盤名稱(如下面教程中RCLONE 配置時填寫的onedrive的name為remote,谷歌網盤為Google)

<span class="hljs-attr">drive-name</span>=remote
<span class="hljs-attr">drive-name</span>=remote
drive-name=remote

重啟 Aria2 。腳本選項重啟或者執行以下命令:

<span class="hljs-attribute">service</span> aria2 restart
<span class="hljs-attribute">service</span> aria2 restart
service aria2 restart

檢查配置是否成功

執行upload.sh腳本,提示success即代上傳腳本能正常被調用,否則請檢查與 RCLONE 有關的配置。

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh0
/root/.aria2c/upload.sh

打開實時日志并下載任意文件,出現上傳成功信息即代表配置成功,否則請認真閱讀教程并重新開始。
檢查網盤是否存在相關文件,若不存在說明你搞錯網盤了。

Rclone介紹

Rclone是一個的命令行工具,支持在不同對象存儲、網盤間同步、上傳、下載數據。并且通過一些設置可以實現離線下載、服務器備份等非常實用的功能。這里以 OneDrive 和 Google Drive 為例子,進行連接配置,其它網盤的操作類似。由于是交互式配置選項,只要能看懂基本沒有任何難度。

安裝Rclone

RCLONE 官方提供了一鍵安裝腳本:

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh1
curl https://rclone.org/install.sh | sudo bash

Rclone 連接 OneDrive

獲取 token

在本地Win-dows電腦上下載rclone win版,然后解壓出來,解壓后進入文件夾,在資源管理器地址欄輸入cmd,回車就會在當前路徑打開命令提示符。輸入以下命令:

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh2
rclone authorize "onedrive"

接下來會彈出瀏覽器,要求你登錄賬號進行授權。授權完后命令提示符窗口會出現以下信息:

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh3
If your browser doesnt open automatically go to the following link: http://127.0.0.1:53682/authLog in and authorize rclone for accessWaiting for code...Got codePaste the following into your remote machine --->{"access_token":"xxxxxxxx"}# 注意!復制{xxxxxxxx}整個內容,并保存好,后面需要用到<---End paste

配置 Rclone

輸入以下命令

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh4
rclone config

會出現以下信息,參照下面的注釋進行操作。
TIPS: 因為 RCLONE 會時不時進行更新,當你看到這篇教程時菜單選項可能已經發生了略微的改動,但大致思路不會變,不要無腦照搬操作。

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh5
e) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> n# 選擇n,新建name> remote# 輸入名稱,類似于標簽,用于區分不同的網盤。Type of storage to configure.Enter a string value. Press Enter for the default ("").Choose a number from below, or type in your own value[snip]XX / Microsoft OneDrive"onedrive"[snip]Storage>XX# 選擇Microsoft OneDrive對應的數字Microsoft App Client IdLeave blank normally.Enter a string value. Press Enter for the default ("").client_id># 留空,回車Microsoft App Client SecretLeave blank normally.Enter a string value. Press Enter for the default ("").client_secret># 留空,回車Edit advanced config? (y/n)y) Yesn) Noy/n> n# 選nRemote configUse auto config? * Say Y if not sure * Say N if you are working on a remote or headless machiney) Yesn) Noy/n> n# 選nFor this to work, you will need rclone available on a machine that has a web browser available.Execute the following on your machine:rclone authorize "onedrive"Then paste the result below:result> {"XXXXXXXX"}# 復制上面Win下獲取的token值到這里Choose a number from below, or type in an existing value 1 / OneDrive Personal or Business"onedrive" 2 / Sharepoint site"sharepoint" 3 / Type in driveID"driveid" 4 / Type in SiteID"siteid" 5 / Search a Sharepoint site"search"Your choice> 1# 這里問你要選擇的類型,選1Found 1 drives, please select the one you want to use:0: OneDrive (business) id=b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqkChose drive to use:> 0# 程序找到網盤,編號是什么數字就填什么數字,一般是0Found drive root of type business, URL: https://org-my.sharepoint.com/personal/you/DocumentsIs that okay?y) Yesn) Noy/n> y--------------------[remote]type = onedrivetoken = {"access_token":"youraccesstoken","token_type":"Bearer","refresh_token":"yourrefreshtoken","expiry":"2021-12-07T09:39:52.486512262+08:00"}drive_id = b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqkdrive_type = business--------------------y) Yes this is OKe) Edit this remoted) Delete this remotey/e/d> y# 選yCurrent remotes:NameType========remoteonedrivee) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> q# 選q,退出

至此,Rclone 已成功連接到了 OneDrive 網盤。

Rclone 連接 Google Drive

與 OneDrive 不同的是,Google Drive 不需要本地 Win-dows 客戶端預先進行授權獲取 to-ken,而是在配置過程中進行授權。

配置 Rclone

輸入以下命令

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh4
rclone config

會出現以下信息,參照下面的注釋進行操作。
TIPS: 因為 RCLONE 會時不時進行更新,當你看到這篇教程時菜單選項可能已經發生了略微的改動,但大致思路不會變,不要無腦照搬操作。

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh7
No remotes found - make a new onen) New remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confign/r/c/s/q>n# 選擇n,新建name> Google# 輸入名稱,類似于標簽,用于區分不同的網盤。Type of storage to configure.Choose a number from below, or type in your own value[snip]XX / Google Drive"drive"[snip]Storage>XX# 選擇Google Drive對應的數字Google Application Client Id - leave blank normally.client_id># 留空,回車Google Application Client Secret - leave blank normally.client_secret># 留空,回車Scope that rclone should use when requesting access from drive.Choose a number from below, or type in your own value 1 / Full access all files, excluding Application Data Folder."drive" 2 / Read-only access to file metadata and file contents."drive.readonly"/ Access to files created by rclone only. 3 | These are visible in the drive website.| File authorization is revoked when the user deauthorizes the app."drive.file"/ Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website."drive.appfolder"/ Allows read-only access to file metadata but 5 | does not allow any access to read or download file content."drive.metadata.readonly"scope> 1# 選擇1ID of the root folder - leave blank normally.Fill in to access "Computers" folders. (see docs).root_folder_id># 留空,回車Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.service_account_file># 留空,回車Remote configUse auto config? * Say Y if not sure * Say N if you are working on a remote or headless machine or Y didnt worky) Yesn) Noy/n>n# 選nIf your browser doesnt open automatically go to the following link: http://127.0.0.1:53682/authLog in and authorize rclone for accessWaiting for code...Got codeConfigure this as a Shared Drive (Team Drive)?y) Yesn) Noy/n> y# 選n--------------------[remote]client_id = client_secret = scope = driveroot_folder_id = service_account_file =token = {"access_token":"XXX","token_type":"Bearer","refresh_token":"XXX","expiry":"2014-03-16T13:57:58.955387075Z"}--------------------y) Yes this is OKe) Edit this remoted) Delete this remotey/e/d> yCurrent remotes:NameType========Googledriveremoteonedrivee) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> q

至此,Rclone 已成功連接到了 Google Drive 網盤。

rclone設置

  • rclone config - 進入交互式配置選項,進行添加、刪除、管理網盤等操作。
  • rclone config file - 顯示配置文件的路徑,一般配置文件在 ~/.config/rclone/rclone.conf
  • rclone config show - 顯示配置文件信息

rclone命令語法

本地到網盤

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh8
rclone [功能選項] <本地路徑> <網盤名稱:路徑> [參數] [參數] ...

網盤到本地

<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh
<span class="hljs-attribute">wget</span> -N git.io/aria2.sh && chmod +x aria2.sh9
rclone [功能選項] <網盤名稱:路徑> <本地路徑> [參數] [參數] ...

網盤到網盤

./aria2.sh
./aria2.sh0
rclone [功能選項] <網盤名稱:路徑> <網盤名稱:路徑> [參數] [參數] ...

示例:

./aria2.sh
./aria2.sh1
rclone move -v /files ftp:/files --transfers=1

rclone選項

  • rclone copy - 復制
  • rclone move - 移動,如果要在移動后刪除空源目錄,請加上 --delete-empty-src-dirs 參數
  • rclone sync - 同步:將源目錄同步到目標目錄,只更改目標目錄。
  • rclone size - 查看網盤文件占用大小。
  • rclone delete - 刪除路徑下的文件內容。
  • rclone purge - 刪除路徑及其所有文件內容。
  • rclone mkdir - 創建目錄。
  • rclone rmdir - 刪除目錄。
  • rclone rmdirs - 刪除指定靈境下的空目錄。如果加上 --leave-root 參數,則不會刪除根目錄。
  • rclone check - 檢查源和目的地址數據是否匹配。
  • rclone ls - 列出指定路徑下的所有的文件以及文件大小和路徑。
  • rclone lsl - 比上面多一個顯示上傳時間。
  • rclone lsd 列出指定路徑下的目錄
  • rclone lsf - 列出指定路徑下的目錄和文件

rclone參數

  • -n = --dry-run 測試運行,用來查看 rclone 在實際運行中會進行哪些操作。
  • -P = --progress 顯示實時傳輸進度,500mS 刷新一次,否則默認 1 分鐘刷新一次。
  • --cache-chunk-size SizeSuffi - 塊的大小,默認 5M,理論上是越大上傳速度越快,同時占用內存也越多。如果設置得太大,可能會導致進程中斷。
  • --cache-chunk-total-size SizeSuffix 塊可以在本地磁盤上占用的總大小,默認 10G。
  • --transfers=N 并行文件數,默認為 4。在比較小的內存的 VPS 上建議調小這個參數,比如 128M 的小雞上使用建議設置為 1。
  • --config string - 指定配置文件路徑,string 為配置文件路徑。
  • --ignore-errors - 跳過錯誤。比如 OneDrive 在傳了某些特殊文件后會提示 Failed to copy: failed to open source object: malwareDetected: Malware detected,這會導致后續的傳輸任務被終止掉,此時就可以加上這個參數跳過錯誤。但需要注意 RCLONE 的退出狀態碼不會為 0。

rclone日志

rclone 有 4 個級別的日志記錄,ERROR,NOTICE,INFO 和 DEBUG。默認情況下,rclone 將生成 ERROR 和 NOTICE 級別消息。

  • -q - rclone 將僅生成 ERROR 消息。
  • -v - rclone 將生成 ERROR,NOTICE 和 INFO 消息,推薦此項。
  • -vv - rclone 將生成 ERROR,NOTICE,INFO 和 DEBUG 消息。
  • --log-level LEVEL - 標志控制日志級別。

 

輸出日志到文件

使用 --log-file=FILE 選項,rclone 會將 Error,Info 和 Debug 消息以及標準錯誤重定向到 FILE,這里的 FILE 是你指定的日志文件路徑。
另一種方法是使用系統的指向命令,比如:

./aria2.sh
./aria2.sh2
rclone sync -v Onedrive:/DRIVEX Gdrive:/DRIVEX > "~/DRIVEX.log" 2>&1

文件過濾

  • --exclude - 排除文件或目錄。
  • --include - 包含文件或目錄。
  • --filter - 文件過濾規則,相當于上面兩個選項的其它使用方式。包含規則以 + 開頭,排除規則以 - 開頭。

文件類型過濾

比如 --exclude "*.bak"、--filter "- *.bak",排除所有 bak 文件。也可以寫作。
比如 --include "*.{png,jpg}"、--filter "+ *.{png,jpg}",包含所有 png 和 jpg 文件,排除其他文件。
--delete-excluded 刪除排除的文件。需配合過濾參數使用,否則無效。

目錄過濾

目錄過濾需要在目錄名稱后面加上 /,否則會被當做文件進行匹配。以 / 開頭只會匹配根目錄(指定目錄下),否則匹配所目錄。這同樣適用于文件。

  • --exclude ".git/" 排除所有目錄下的.git 目錄。
  • --exclude "/.git/" 只排除根目錄下的.git 目錄。
  • --exclude "{Video,Software}/" 排除所有目錄下的 Video 和 Software 目錄。
  • --exclude "/{Video,Software}/" 只排除根目錄下的 Video 和 Software 目錄。
  • --include "/{Video,Software}/**" 僅包含根目錄下的 Video 和 Software 目錄的所有內容。

 

文件大小過濾

默認大小單位為 kBytes ,但可以使用 k ,M 或 G 后綴。

  • --min-size 過濾小于指定大小的文件。比如 --min-size 50 表示不會傳輸小于 50k 的文件。
  • --max-size 過濾大于指定大小的文件。比如 --max-size 1G 表示不會傳輸大于 1G 的文件。

 

環境變量

rclone 中的每個選項都可以通過環境變量設置。環境變量的名稱可以通過長選項名稱進行轉換,刪除 -- 前綴,更改 - 為 _,大寫并添加前綴 RCLONE_。環境變量的優先級會低于命令行選項,即通過命令行追加相應的選項時會覆蓋環境變量設定的值。
比如設置最小上傳大小 --min-size 50,使用環境變量是 RCLONE_MIN_SIZE=50。當環境變量設置后,在命令行中使用 --min-size 100,那么此時環境變量的值就會被覆蓋。

  • RCLONE_CONFIG - 自定義配置文件路徑
  • RCLONE_CONFIG_PASS - 若 rclone 進行了加密設置,把此環境變量設置為密碼,可自動解密配置文件。
  • RCLONE_RETRIES - 上傳失敗重試次數,默認 3 次
  • RCLONE_RETRIES_SLEEP - 上傳失敗重試等待時間,默認禁用,單位 s、m、h 分別代表秒、分鐘、小時。
  • CLONE_TRANSFERS - 并行上傳文件數。
  • RCLONE_CACHE_CHUNK_SIZE - 塊的大小,默認 5M,理論上是越大上傳速度越快,同時占用內存也越多。如果設置得太大,可能會導致進程中斷。
  • RCLONE_CACHE_CHUNK_TOTAL_SIZE - 塊可以在本地磁盤上占用的總大小,默認 10G。
  • RCLONE_IGNORE_ERRORS=true - 跳過錯誤。

 

Nginx 反向代理 Aria2 JSONRPC

給Aria2服務器所用的SSL證書往往不支持Aria2所使用的6800端口,而80/443端口還要提供HTTP服務,為此就需要用Nginx來實現同時提供HTTP和Aria2 JSONRPC服務了。

禁止外網直接訪問Aria2 RPC

修改Aria2配置文件

./aria2.sh
./aria2.sh3
#允許所有來源, web界面跨域權限需要rpc-allow-origin-all=false#允許非外部訪問rpc-listen-all=false#RPC端口, 僅當默認端口被占用時修改rpc-listen-port=6800

修改你的站點的Nginx配置文件

./aria2.sh
./aria2.sh4
#ARIA2location /jsonrpc {proxy_pass http://localhost:6800/jsonrpc;proxy_redirect off;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header Host $host;#以下代碼使支持WebSocketproxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";}

其中 location /jsonrpc 表示設置好后RPC地址為 //example.com/jsonrpc

這樣做還有一個好處,那就是不需要單獨為Aria2 RPC服務器設置密碼驗證了。認證直接靠nginx完成,能見到webui就能連上ARIA2 RPC

說明
  • 推薦安裝使用寶塔進行部署操作,傻瓜簡便式。
  • 配合Cloudreve或者Onemanager管理下載文件,實現影音文件在線觀看或下載。
  • 配合Cloudflare靜態資源長時間緩存,減少回源Onedrive或Google網盤,食用效果更佳。
  • 內容整理自網絡,感謝P3TERX提供優秀的腳本!
內容看完了