当前位置:网站首页>Use lightweight application server to automatically download and upload to onedrive

Use lightweight application server to automatically download and upload to onedrive

2022-06-24 03:32:00 yolk

cover

programme

aria2 Add onemanger

Buy lightweight application servers

picture .png

Optional configuration , Select according to the server region of the file to be downloaded . I chose the pagoda here for convenience

Start deployment

1. install aria2

wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh

Press the prompt to configure

2. Deploy onemanager

Let's just mention it here

Click me to download the latest code

Upload the code to the website directory

Configure pseudo static The rules

Follow the instructions to install , And will OneDrive Mount it .

3. Configure automatic download and upload

In the first step , installed aria2 Tips are as follows

RPC  port 	: 6800
 RPC  secret key 	: xxxx
  Download directory 	: /root/downloads
 AriaNg  link :

there ariang It's our download console

Install uploader

wget https://raw.githubusercontent.com/MoeClub/OneList/master/OneDriveUploader/amd64/linux/OneDriveUploader -P /usr/local/bin/
chmod +x /usr/local/bin/OneDriveUploader

Follow the instructions to install

New file upload.sh

#!/bin/bash

GID="$1";
FileNum="$2";
File="$3";
MaxSize="15728640";
Thread="3";    #  Default 3 Threads , Modify yourself , If the server configuration is not good , Not too much 
Block="20";    #  Default blocking 20m, Modify yourself 
RemoteDIR="download/";  #  Upload to Onedrive The path of , Default to root , If you want to upload to File Catalog ,"" Please fill in File
LocalDIR="/root/download/";       # Aria2 Download directory , Remember to add... At the end /
Uploader="/usr/local/bin/OneDriveUploader";  #  The full path of the uploaded program , The default is the directory installed in this article 
Config="/root/auth.json";  #  Initialize the generated configuration auth.json Absolute path 

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(){
  if [[ ! -e "${Uploader}" ]]; then return; fi
  IFS_BAK=$IFS
  IFS=$'\n'
  tmpFile="$(echo "${File/#$LocalDIR}" |cut -f1 -d'/')"
  FileLoad="${LocalDIR}${tmpFile}"
  if [[ ! -e "${FileLoad}" ]]; then return; fi
  ItemSize=$(du -s "${FileLoad}" |cut -f1 |grep -o '[0-9]*' |head -n1)
  if [[ -z "$ItemSize" ]]; then return; fi
  if [[ "$ItemSize" -ge "$MaxSize" ]]; then
    echo -ne "\033[33m${FileLoad} \033[0mtoo large to spik.\n";
    return;
  fi
  ${Uploader} -c "${Config}" -t "${Thread}" -b "${Block}" -s "${FileLoad}" -r "${RemoteDIR}" -skip
  if [[ $? == '0' ]]; then
    rm -rf "${FileLoad}";
  fi
  IFS=$IFS_BAK
}
LoadFile;

Don't copy the code !, Fill in according to personal configuration .

Enter the command aria2

Open profile , Find the following text , Click below to modify .

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

Input again aria2, restart aria2

Since then, our automatic upload and download server has been configured , stay ariang Submitting the download task will automatically upload to OneDrive

If this article helps you , Please give me a big compliment (≧▽≦)

** I am egg yolk , Be with you “ Soar up the clouds ”!

Reference material :https://www.moerats.com/archives/1006/

原网站

版权声明
本文为[yolk]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/10/20211002145421649t.html

随机推荐