sh Ubuntu的安装并配置aria2
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Ubuntu的安装并配置aria2相关的知识,希望对你有一定的参考价值。
#!/bin/bash
#
# Ubuntu安装并配置aria2
#
# @Author: Jaeger <JaegerCode@gmail.com>
# @Version: 0.1
#配置文件下载保存路径
downloadPath='/user-files/superuser/dl'
basePath='/home/aria2'
apt update
apt install sudo wget unzip -y
mkdir -p $downloadPath $basePath
file1=$basePath/aria2.s
file2=$basePath/aria2.log
touch $file1 $file2
configFile=$basePath/aria2.conf
configTpl="
continue=true \n
daemon=true \n
dir=$downloadPath \n
enable-rpc=true \n
file-allocation=none \n
force-sequential=true \n
input-file=$file1 \n
log=$file2 \n
log-level=notice \n
max-concurrent-downloads=3 \n
max-connection-per-server=5 \n
parameterized-uri=true \n
rpc-allow-origin-all=true \n
rpc-listen-all=true \n
rpc-save-upload-metadata=true \n
save-session=$file1 \n
save-session-interval=30 \n
split=2 \n
"
echo -e $configTpl>$configFile
comTpl="
#!/bin/sh \n
#之前的配置文件 \n
CONF=$configFile \n
\n
case \"\$1\" in \n
start) \n
echo \"Starting aria2c service\" \n
sudo aria2c --conf-path=\$CONF -D \n
echo \"done !\" \n
;; \n
stop) \n
echo \"Stopping aria2c service\" \n
sudo killall -w aria2c \n
echo \"done !\" \n
;; \n
restart) \n
echo \"Restarting aria2c service\" \n
sudo killall -w aria2c \n
sudo aria2c --conf-path=\$CONF -D \n
echo \"done !\" \n
;; \n
*) \n
echo \"\$0 {start|stop|restart}\" \n
;; \n
esac \n
exit
"
echo -e $comTpl>/etc/init.d/aria2
chmod +x /etc/init.d/aria2
apt install aria2 -y
service aria2 start
# 开机启动
update-rc.d aria2 defaults
## 安装AriaNg
wget https://github.com/mayswind/AriaNg-DailyBuild/archive/master.zip
unzip master.zip -d /var/www/html/
rm master.zip
mv /var/www/html/AriaNg-DailyBuild-master /var/www/html/dweb
#!/bin/bash
#
# Ubuntu安装并配置aria2
#
# @Author: Jaeger <JaegerCode@gmail.com>
# @Version: 0.1
#配置文件下载保存路径
downloadPath='/var/www/html/dl'
basePath='/home/aria2'
mkdir -p $downloadPath $basePath
file1=$basePath/aria2.s
file2=$basePath/aria2.log
touch $file1 $file2
configFile=$basePath/aria2.conf
configTpl="
continue=true \n
daemon=true \n
dir=$downloadPath \n
enable-rpc=true \n
file-allocation=none \n
force-sequential=true \n
input-file=$file1 \n
log=$file2 \n
log-level=notice \n
max-concurrent-downloads=3 \n
max-connection-per-server=5 \n
parameterized-uri=true \n
rpc-allow-origin-all=true \n
rpc-listen-all=true \n
rpc-save-upload-metadata=true \n
save-session=$file1 \n
save-session-interval=30 \n
split=2 \n
"
echo -e $configTpl>$configFile
comTpl="
#!/bin/sh \n
#之前的配置文件 \n
CONF=$configFile \n
\n
case \"\$1\" in \n
start) \n
echo \"Starting aria2c service\" \n
sudo aria2c --conf-path=\$CONF -D \n
echo \"done !\" \n
;; \n
stop) \n
echo \"Stopping aria2c service\" \n
sudo killall -w aria2c \n
echo \"done !\" \n
;; \n
restart) \n
echo \"Restarting aria2c service\" \n
sudo killall -w aria2c \n
sudo aria2c --conf-path=\$CONF -D \n
echo \"done !\" \n
;; \n
*) \n
echo \"\$0 {start|stop|restart}\" \n
;; \n
esac \n
exit
"
echo -e $comTpl>/etc/init.d/aria2
chmod +x /etc/init.d/aria2
apt update
apt install sudo aria2 -y
service aria2 start
# 开机启动
update-rc.d aria2 defaults
以上是关于sh Ubuntu的安装并配置aria2的主要内容,如果未能解决你的问题,请参考以下文章
使用Aria2+Aria2Ng+OneIndex+OneDrive建立不限流量/离线BT下载/在线观看网盘/在线存储分享平台