需要用到的docker命令:
docker ps // 查看所有正在运行容器
docker stop containerId // containerId 是容器的ID
docker ps -a // 查看所有容器
docker ps -a -q // 查看所有容器ID
docker images //查看所有镜像
docker stop 容器id //停止某个容器
docker rm 容器id //删除某个容器
docker rmi 镜像id或名称 //删除镜像
docker logs -f --tail 30 容器id //查看容器日志
docker exec -it 容器id bash //进入容器
需要用到的rclone命令:
# 本地到网盘
rclone [功能选项] <本地路径> <网盘名称:路径> [参数] [参数] ...
# 网盘到本地
rclone [功能选项] <网盘名称:路径> <本地路径> [参数] [参数] ...
# 网盘到网盘
rclone [功能选项] <网盘名称:路径> <网盘名称:路径> [参数] [参数] ...
rclone copy - 复制
rclone move - 移动,如果要在移动后删除空源目录,请加上 --delete-empty-src-dirs 参数
rclone sync - 同步:将源目录同步到目标目录,只更改目标目录。
rclone size - 查看网盘文件占用大小。
rclone move -v /Download Onedrive:/Download --transfers=1
--transfers=N - 并行文件数,默认为4。在比较小的内存的VPS上建议调小这个参数,比如128M的小鸡上使用建议设置为1
ps:复制和移动,是操作路径下的文件,并不包括路径本身的文件夹
例如有Download下两个文件夹
/Download/game/1.txt
/Download/anime/2.txt
则
rclone move -v /Download Onedrive:/Download
是将game和amime两个文件夹移动到网盘的Download下,不包括本地的Download文件夹。
rclone 连接 OneDrive,获取token:
首先window下下载rclone,cmd进入路径后执行命令:
rclone authorize "onedrive"
弹出浏览器后登录OneDrive,cmd获取token
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
Paste the following into your remote machine --->
{"access_token":"xxxxxxxx"} # 注意!复制{xxxxxxxx}整个内容,并保存好,后面需要用到
<---End paste
同时下载不同文件并上传到不同的网盘:
docker run -d \
--name aria2-pro \
--restart unless-stopped \
--log-opt max-size=1m \
--network host \
-e PUID=$UID \
-e PGID=$GID \
-e RPC_SECRET=P3TERX \
-e RPC_PORT=6800 \
-e LISTEN_PORT=6888 \
-v ~/aria2-config:/config \
-v ~/rclone-downloads:/downloads \
-e SPECIAL_MODE=rclone \
p3terx/aria2-pro
docker run -d \
--name aria2-onedrive \
--restart unless-stopped \
--log-opt max-size=1m \
--network host \
-e PUID=$UID \
-e PGID=$GID \
-e RPC_SECRET=P3TERX \
-e RPC_PORT=6803 \
-e LISTEN_PORT=33333 \
-v ~/aria2-onedrive-config:/config \
-v ~/onedrive-downloads:/downloads \
-e SPECIAL_MODE=rclone \
p3terx/aria2-pro
容器的名字,端口,配置文件和下载地址可根据实际情况进行修改。端口设置后记得开启。
firewall-cmd --add-port=6800/tcp --permanent
firewall-cmd --add-port=6888/tcp --permanent
firewall-cmd --add-port=6803/tcp --permanent
firewall-cmd --add-port=33333/tcp --permanent
设置容器的rclone:
- 之前若使用过 RCLONE 直接把配置文件(
rclone.conf
)复制到 Aria2 Pro 配置目录下即可。 RCLONE 配置文件可以在宿主机的默认位置找到:~/.config/rclone/rclone.conf
- 初次使用或者想要配置 RCLONE 可使用
docker exec -it aria2-pro rclone config
命令进入容器内的 RCLONE 交互菜单选项
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n # 选择n,新建
name> P3TERX # 输入名称,类似于标签,用于区分不同的网盘。
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
1 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for a existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Local Disk
\ "local"
16 / Mega
\ "mega"
17 / Microsoft Azure Blob Storage
\ "azureblob"
18 / Microsoft OneDrive
\ "onedrive"
19 / OpenDrive
\ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
21 / Pcloud
\ "pcloud"
22 / QingCloud Object Storage
\ "qingstor"
23 / SSH/SFTP Connection
\ "sftp"
24 / Webdav
\ "webdav"
25 / Yandex Disk
\ "yandex"
26 / http Connection
\ "http"
Storage> 18 # 选择18,Microsoft OneDrive
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> # 留空,回车
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> # 留空,回车
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n # 选n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n # 选n
For 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"} # 上面保存的token复制到这里
2018/10/31 19:54:06 ERROR : Failed to save new token in config file: section 'P3TERX' not found
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"
Your choice> 1 # 这里问你要选择的类型,选1
Found 1 drives, please select the one you want to use:
0: OneDrive (business)
Chose drive to use:> 0 # 程序找到网盘,这里编号是0,就选择0
Found drive 'root' of type 'business', URL: https://xxxxxx-my.sharepoint.com/personal/xxxxxxx/Documents
Is that okay?
y) Yes
n) No
y/n> y # 选y
--------------------
[P3TERX]
type = onedrive
token = {"XXXXXXXX"}
drive_id = XXXXXXXXX
drive_type = business
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y # 选y
Current remotes:
Name Type
==== ====
P3TERX onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q # 选q,退出
最后根据实际情况修改 Aria2 Pro 配置文件目录下script.conf
文件中的网盘名称(drive-name
)和网盘路径(drive-dir
)这两个选项的值。