Tutorial on using Aria2 to automatically upload files to onedrive

888u

Last update at :2024-07-02,Edit by888u

1. First create an upload folder in onedrive to receive uploads uniformly

2. Then start building an environment pagoda or lnmp, nginx+php (the database is not used, it doesn’t matter if it is installed or not)

3. Create two sites

dl.example.com (for downloading) pan.example.com (for network disk)

4. Install aria2. Here we recommend the one-click method of Funny Boy (which saves trouble). It also supports automatic update of BT-Tracker

wget -N --no-check-certificate https://softs.loan/Bash/aria2.sh && chmod +x aria2.sh && bash aria2.sh

5. Then download the AriaNg (dl.example.com) and oneindex (pan.example.com) source codes to the corresponding sites

https://github.com/mayswind/AriaNg /releases/download/0.4.0/aria-ng-0.4.0.zip

https://github.com/donwa/oneindex

6. Edit the download directory in /root/.aria2/.aria2.conf (set by yourself)

# Save path of the file (can use absolute path or relative path), default: current startup location dir=/your directory/download

And add a line at the end

on-download-complete=/root/upload2one.sh

Save

7. Then create a new /root/upload2one.sh and enter the following code

#!/bin/bash path=$3 downloadpath='/aria2 download directory' if [ $2 -eq 0 ] then exit 0 fi while true; do #Extract the root path of the download file, such as changing /root/downloads/a/b/c/d.jpg to /root/downloads/a filepath=$path path=${path%/*}; if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ] #If you download a single file then /PHP specific path/bin/php /pan.example.com specific path/one.php upload:file "$filepath" /upload/ rm -rf "$filepath" exit 0 elif [ "$path" = "$downloadpath" ] #folder then /PHP specific path/bin/php /pan.example.com specific path/one.php upload:folder "$filepath"/ /upload/"${filepath##*/}"/ rm -rf "$filepath"/ exit 0 fi done

Save

8. Grant permissions

chmod +x /root/upload2one.sh

9. Restart aria2, open dl.example.com, enter the key given during installation in AriaNg->RPC key, refresh and connect, and the download will be completed

10. Then install oneindex requirements: 1. PHP space, PHP 5.6+ to open curl support 2. onedrive account (personal, enterprise or educational version/work or school account) 3. oneindex program

Installation steps:

After installation, you can download files in AriaNg, and they will be automatically uploaded to the upload directory of the network disk and the files on the server will be deleted

Reference: https://sonet.today/?p=639http://www.hostloc.com/thread-421797-1-1.html

via:http://www.hostloc.com/thread-459503-1-2.html

Recommended site searches: US hosting reviews, Ministry of Industry and Information Technology registration system, php hosting, free asp space, registered domain name query, Korean server rental, Taiwan proxy server, domain name purchase free hosting, application for free space,

Tutorial on using Aria2 to automatically upload files to onedrive

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码