Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.