From 8c77c0912330055b8db50bce036f7c8fd66c4ef1 Mon Sep 17 00:00:00 2001 From: P3TERX Date: Mon, 17 Feb 2020 08:01:27 +0800 Subject: [PATCH] =?UTF-8?q?Update=20v2.1.0=20-=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E6=96=B0=E7=89=88=20[Aria2=20=E5=AE=8C=E7=BE=8E=E9=85=8D?= =?UTF-8?q?=E7=BD=AE](https://github.com/P3TERX/aria2.conf)=20-=20?= =?UTF-8?q?=E5=88=86=E7=A6=BB=20trackers=20=E6=9B=B4=E6=96=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20-=20=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BB=86=E8=8A=82=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=8B=A5=E5=B9=B2=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 1 + README.md | 52 ++++++++------- aria2.sh | 155 +++++++++++++++++++------------------------ service/aria2_centos | 17 +++-- service/aria2_debian | 17 +++-- 5 files changed, 118 insertions(+), 124 deletions(-) diff --git a/LICENSE b/LICENSE index b9adc1c..b688406 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ MIT License +Copyright (c) 2017 Toyo Copyright (c) 2018 P3TERX Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index 28686cc..ea25956 100644 --- a/README.md +++ b/README.md @@ -12,29 +12,19 @@ https://github.com/P3TERX/aria2.sh CentOS 6+ / Debian 6+ / Ubuntu 14.04+ -## 下载安装 - -执行下面的代码下载并运行脚本,出现脚本操作菜单输入 `1` 开始安装。 - -```shell -wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh -``` - ## 使用说明 -* 进入下载脚本的目录并运行脚本 - - ``` - ./aria2.sh - ``` +* 执行下面的代码运行脚本 +``` +bash <(wget -qO- git.io/aria2.sh) +``` * 选择你要执行的选项 - - ``` - Aria2 一键安装管理脚本 [v2.0.8] +``` + Aria2 一键安装管理脚本 [v2.10.0] -- P3TERX.COM -- - 1. 升级脚本 + 0. 升级脚本 ———————————— 1. 安装 Aria2 2. 更新 Aria2 @@ -56,7 +46,7 @@ wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh 当前状态: 已安装 并 已启动 请输入数字 [0-12]: - ``` +``` ## 其他操作 @@ -76,13 +66,16 @@ wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh ## 附加功能 -整合了 [Aria2 完美配置](https://github.com/P3TERX/aria2_perfect_config),在安装 Aria2 的过程中会下载这套配置方案,包含了配置文件、附加功能脚本等文件,用于实现 Aria2 功能的增强和扩展。 +整合了 [Aria2 完美配置](https://github.com/P3TERX/aria2.conf),在安装 Aria2 的过程中会下载这套配置方案,包含了配置文件、附加功能脚本等文件,用于实现 Aria2 功能的增强和扩展,提升 Aria2 的使用体验。 增强功能: -* 提升BT下载率和下载速度 -* 下载完成删除残留的`.aria2`后缀名文件 -* 下载错误或取消下载删除未完成的文件 +* 提升 BT 下载率和下载速度 +* 重启后不丢失任务进度、不重复下载 +* 下载错误或取消下载自动删除未完成的文件防止磁盘空间占用 +* 下载完成自动清除`.aria2`后缀名文件 +* 更好的 PT 下载支持 +* 防版权投诉、防迅雷吸血 扩展功能: @@ -91,13 +84,21 @@ wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh ## 更新日志 -### 2019-11-23 v2.0.8 +### 2020-02-17 v2.1.0 -- 修改 Trackers 来源([XIU2/TrackersListCollection](https://github.com/XIU2/TrackersListCollection)) +> **TIPS:** 卸载后升级,否则会导致功能异常。 + +- 适配新版 [Aria2 完美配置](https://github.com/P3TERX/aria2.conf) +- 分离 trackers 更新功能 +- 优化功能,完善细节,修复若干 bug
历史记录 +### 2019-11-23 v2.0.8 + +- 修改 Trackers 来源([XIU2/TrackersListCollection](https://github.com/XIU2/TrackersListCollection)) + ### 2019-10-12 v2.0.7 - 修复 Aria2 版本更新时因未获取 CPU 架构导致版本下载错误且无法启动的 bug @@ -139,3 +140,6 @@ wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh - 感谢 Toyo 大佬
+ +## Lisence +[MIT](https://github.com/P3TERX/aria2.sh/blob/master/LICENSE) © Toyo x P3TERX diff --git a/aria2.sh b/aria2.sh index dbbf89f..c4e063c 100644 --- a/aria2.sh +++ b/aria2.sh @@ -1,32 +1,31 @@ #!/usr/bin/env bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -#================================================= +#============================================================= +# https://github.com/P3TERX/aria2.sh +# Description: Aria2 One-click installation management script # System Required: CentOS/Debian/Ubuntu -# Description: Aria2 -# Version: 2.0.8 -# Author: P3TERX +# Version: 2.1.0 +# Author: Toyo +# Maintainer: P3TERX # Blog: https://p3terx.com -#================================================= -sh_ver="2.0.8" -filepath=$(cd "$(dirname "$0")"; pwd) -file_1=$(echo -e "${filepath}"|awk -F "$0" '{print $1}') +#============================================================= + +sh_ver="2.1.0" +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH file="/root/.aria2" +download_path="/root/Download" aria2_conf="/root/.aria2/aria2.conf" aria2_log="/root/.aria2/aria2.log" -autoupload_sh="/root/.aria2/autoupload.sh" -delete_aria2_sh="/root/.aria2/delete.aria2.sh" -delete_sh="/root/.aria2/delete.sh" -info_sh="/root/.aria2/info.sh" -Folder="/usr/local/aria2" -aria2c="/usr/bin/aria2c" +aria2c="/usr/local/bin/aria2c" Crontab_file="/usr/bin/crontab" - -Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" -Info="${Green_font_prefix}[信息]${Font_color_suffix}" -Error="${Red_font_prefix}[错误]${Font_color_suffix}" -Tip="${Green_font_prefix}[注意]${Font_color_suffix}" +Green_font_prefix="\033[32m" +Red_font_prefix="\033[31m" +Green_background_prefix="\033[42;37m" +Red_background_prefix="\033[41;37m" +Font_color_suffix="\033[0m" +Info="[${Green_font_prefix}信息${Font_color_suffix}]" +Error="[${Red_font_prefix}错误${Font_color_suffix}]" +Tip="[${Green_font_prefix}注意${Font_color_suffix}]" check_root(){ [[ $EUID != 0 ]] && echo -e "${Error} 当前非ROOT账号(或没有ROOT权限),无法继续操作,请更换ROOT账号或使用 ${Green_background_prefix}sudo su${Font_color_suffix} 命令获取临时ROOT权限(执行后可能会提示输入当前账号的密码)。" && exit 1 @@ -108,11 +107,9 @@ check_ver_comparison(){ } Download_aria2(){ update_dl=$1 - cd "/usr/local" - #echo -e "${bit}" if [[ ${bit} == "x86_64" ]]; then bit="64bit" - elif [[ ${bit} == "i386" || ${bit} == "i686" ]]; then + elif [[ ${bit} == i*86 ]]; then bit="32bit" else bit="arm-rbpi" @@ -121,16 +118,14 @@ Download_aria2(){ Aria2_Name="aria2-${aria2_new_ver}-linux-gnu-${bit}-build1" [[ ! -s "${Aria2_Name}.tar.bz2" ]] && echo -e "${Error} Aria2 压缩包下载失败 !" && exit 1 - tar jxvf "${Aria2_Name}.tar.bz2" - [[ ! -e "/usr/local/${Aria2_Name}" ]] && echo -e "${Error} Aria2 解压失败 !" && rm -rf "${Aria2_Name}.tar.bz2" && exit 1 - [[ ${update_dl} = "update" ]] && rm -rf "${Folder}" - mv "/usr/local/${Aria2_Name}" "${Folder}" - [[ ! -e "${Folder}" ]] && echo -e "${Error} Aria2 文件夹重命名失败 !" && rm -rf "${Aria2_Name}.tar.bz2" && rm -rf "/usr/local/${Aria2_Name}" && exit 1 - rm -rf "${Aria2_Name}.tar.bz2" - cd "${Folder}" - make install - [[ ! -e ${aria2c} ]] && echo -e "${Error} Aria2 主程序安装失败!" && rm -rf "${Folder}" && exit 1 - chmod +x aria2c + tar jxf "${Aria2_Name}.tar.bz2" + [[ ! -e "${Aria2_Name}" ]] && echo -e "${Error} Aria2 解压失败 !" && rm -rf "${Aria2_Name}.tar.bz2" && exit 1 + [[ ${update_dl} = "update" ]] && rm -f "${aria2c}" + cp "${Aria2_Name}/aria2c" /usr/local/bin + [[ ! -e /etc/ssl/certs/ca-certificates.crt ]] && (mkdir -p /etc/ssl/certs && cp ${Aria2_Name}/ca-certificates.crt /etc/ssl/certs) + rm -rf "${Aria2_Name}.tar.bz2" "${Aria2_Name}" + [[ ! -e ${aria2c} ]] && echo -e "${Error} Aria2 主程序安装失败!" && exit 1 + chmod +x ${aria2c} echo -e "${Info} Aria2 主程序安装完成!" } Download_aria2_conf(){ @@ -145,12 +140,14 @@ Download_aria2_conf(){ [[ ! -s "delete.sh" ]] && echo -e "${Error} 附加功能脚本[delete.sh]下载失败 !" && rm -rf "${file}" && exit 1 wget -N "https://raw.githubusercontent.com/P3TERX/aria2_perfect_config/master/info.sh" [[ ! -s "info.sh" ]] && echo -e "${Error} 附加功能脚本[info.sh]下载失败 !" && rm -rf "${file}" && exit 1 - chmod +x autoupload.sh delete.aria2.sh delete.sh info.sh wget -N "https://raw.githubusercontent.com/P3TERX/aria2_perfect_config/master/dht.dat" [[ ! -s "dht.dat" ]] && echo -e "${Error} Aria2 DHT(IPv4)文件下载失败 !" && rm -rf "${file}" && exit 1 wget -N "https://raw.githubusercontent.com/P3TERX/aria2_perfect_config/master/dht6.dat" [[ ! -s "dht6.dat" ]] && echo -e "${Error} Aria2 DHT(IPv6)文件下载失败 !" && rm -rf "${file}" && exit 1 - echo '' > aria2.session + touch aria2.session + chmod +x *.sh + sed -i "/^downloadpath=/c\downloadpath='${download_path}'" ${file}/*.sh + sed -i "/^DOWNLOAD_PATH=/c\DOWNLOAD_PATH='${download_path}'" ${file}/*.sh sed -i 's/^rpc-secret=P3TERX/rpc-secret='$(date +%s%N | md5sum | head -c 20)'/g' ${aria2_conf} echo -e "${Info} Aria2 完美配置下载完成!" } @@ -174,11 +171,10 @@ Service_aria2(){ Installation_dependency(){ if [[ ${release} = "centos" ]]; then yum update - yum -y groupinstall "Development Tools" - yum install nano -y + yum install nano ca-certificates -y else apt-get update - apt-get install nano build-essential -y + apt-get install nano ca-certificates -y fi } Install_aria2(){ @@ -203,7 +199,7 @@ Install_aria2(){ echo -e "${Info} 开始保存 iptables防火墙规则..." Save_iptables echo -e "${Info} 开始创建 下载目录..." - mkdir -p /root/Download + mkdir -p ${download_path} echo -e "${Info} 所有步骤 安装完毕,开始启动..." Start_aria2 } @@ -350,8 +346,8 @@ Set_aria2_RPC_dir(){ aria2_dir_1=${aria2_dir} fi echo -e "请输入要设置的 Aria2 文件下载位置(旧位置为:${Green_font_prefix}${aria2_dir_1}${Font_color_suffix})" - read -e -p "(默认位置: /root/Download):" aria2_RPC_dir - [[ -z "${aria2_RPC_dir}" ]] && aria2_RPC_dir="/root/Download" + read -e -p "(默认位置: ${download_path}):" aria2_RPC_dir + [[ -z "${aria2_RPC_dir}" ]] && aria2_RPC_dir="${download_path}" mkdir -p ${aria2_RPC_dir} echo if [[ -d "${aria2_RPC_dir}" ]]; then @@ -370,7 +366,8 @@ Set_aria2_RPC_dir(){ aria2_dir_2=$(echo "${aria2_dir}"|sed 's/\//\\\//g') aria2_RPC_dir_2=$(echo "${aria2_RPC_dir}"|sed 's/\//\\\//g') sed -i 's/^dir='${aria2_dir_2}'/dir='${aria2_RPC_dir_2}'/g' ${aria2_conf} - sed -i 's/^downloadpath='\'${aria2_dir_2}\''/downloadpath='\'${aria2_RPC_dir_2}\''/g' ${autoupload_sh} ${delete_aria2_sh} ${delete_sh} ${info_sh} + sed -i "/^downloadpath=/c\downloadpath='${aria2_RPC_dir_2}'" ${file}/*.sh + sed -i "/^DOWNLOAD_PATH=/c\DOWNLOAD_PATH='${aria2_RPC_dir_2}'" ${file}/*.sh if [[ $? -eq 0 ]];then echo -e "${Info} 位置修改成功!新位置为:${Green_font_prefix}${aria2_RPC_dir}${Font_color_suffix}" if [[ ${read_123} != "1" ]]; then @@ -418,7 +415,8 @@ ${Green_font_prefix}5.${Font_color_suffix} 如果你想在本地编辑配置文 mkdir -p ${aria2_dir} aria2_dir_2=$(echo "${aria2_dir}"|sed 's/\//\\\//g') aria2_dir_old_2=$(echo "${aria2_dir_old}"|sed 's/\//\\\//g') - sed -i 's/^downloadpath='\'${aria2_dir_old_2}\''/downloadpath='\'${aria2_dir_2}\''/g' ${autoupload_sh} ${delete_aria2_sh} ${delete_sh} ${info_sh} + sed -i "/^downloadpath=/c\downloadpath='${aria2_RPC_dir_2}'" ${file}/*.sh + sed -i "/^DOWNLOAD_PATH=/c\DOWNLOAD_PATH='${aria2_RPC_dir_2}'" ${file}/*.sh fi Restart_aria2 } @@ -485,10 +483,10 @@ Clean_Log(){ > ${aria2_log} echo -e "${Info} Aria2 日志已清空 !" } -Update_bt_tracker(){ +Update_bt_tracker_cron(){ check_installed_status check_crontab_installed_status - crontab_update_status=$(crontab -l|grep "aria2.sh update-bt-tracker") + crontab_update_status=$(crontab -l|grep "bash <(wget -qO- git.io/tracker.sh) ${aria2_conf}") if [[ -z "${crontab_update_status}" ]]; then echo && echo -e "当前自动更新模式: ${Red_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Aria2 自动更新 BT-Tracker${Font_color_suffix} 功能吗?(一般情况下会加强BT下载效果)[Y/n]" @@ -512,46 +510,37 @@ Update_bt_tracker(){ fi } crontab_update_start(){ - crontab -l > "$file_1/crontab.bak" - sed -i "/aria2.sh update-bt-tracker/d" "$file_1/crontab.bak" - echo -e "\n0 3 * * 1 /bin/bash $file_1/aria2.sh update-bt-tracker" >> "$file_1/crontab.bak" - crontab "$file_1/crontab.bak" - rm -f "$file_1/crontab.bak" - cron_config=$(crontab -l | grep "aria2.sh update-bt-tracker") + crontab -l > "/tmp/crontab.bak" + sed -i "/aria2.sh update-bt-tracker/d" "/tmp/crontab.bak" + echo -e "\n0 3 * * 1 /bin/bash <(wget -qO- git.io/tracker.sh) ${aria2_conf}" >> "/tmp/crontab.bak" + crontab "/tmp/crontab.bak" + rm -f "/tmp/crontab.bak" + cron_config=$(crontab -l | grep "bash <(wget -qO- git.io/tracker.sh) ${aria2_conf}") if [[ -z ${cron_config} ]]; then echo -e "${Error} Aria2 自动更新 BT-Tracker 开启失败 !" && exit 1 else + bash <(wget -qO- git.io/tracker.sh) ${aria2_conf} echo -e "${Info} Aria2 自动更新 BT-Tracker 开启成功 !" - Update_bt_tracker_cron fi } crontab_update_stop(){ - crontab -l > "$file_1/crontab.bak" - sed -i "/aria2.sh update-bt-tracker/d" "$file_1/crontab.bak" - crontab "$file_1/crontab.bak" - rm -f "$file_1/crontab.bak" - cron_config=$(crontab -l | grep "aria2.sh update-bt-tracker") + crontab -l > "/tmp/crontab.bak" + sed -i "/aria2.sh update-bt-tracker/d" "/tmp/crontab.bak" + sed -i "/tracker.sh/d" "/tmp/crontab.bak" + crontab "/tmp/crontab.bak" + rm -f "/tmp/crontab.bak" + cron_config=$(crontab -l | grep "bash <(wget -qO- git.io/tracker.sh) ${aria2_conf}") if [[ ! -z ${cron_config} ]]; then echo -e "${Error} Aria2 自动更新 BT-Tracker 停止失败 !" && exit 1 else echo -e "${Info} Aria2 自动更新 BT-Tracker 停止成功 !" fi } -Update_bt_tracker_cron(){ +Update_bt_tracker(){ check_installed_status check_pid [[ ! -z ${PID} ]] && /etc/init.d/aria2 stop - # https://github.com/ngosang/trackerslist - #bt_tracker_list=$(wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt |awk NF|sed ":a;N;s/\n/,/g;ta") - # https://github.com/XIU2/TrackersListCollection - bt_tracker_list=$(wget -qO- https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/all.txt |awk NF|sed ":a;N;s/\n/,/g;ta") - if [ -z "`grep "bt-tracker" ${aria2_conf}`" ]; then - sed -i '$a bt-tracker='${bt_tracker_list} "${aria2_conf}" - echo -e "${Info} BT-Tracker 添加成功!" - else - sed -i "s@bt-tracker.*@bt-tracker=$bt_tracker_list@g" "${aria2_conf}" - echo -e "${Info} BT-Tracker 更新成功!" - fi + bash <(wget -qO- git.io/tracker.sh) ${aria2_conf} /etc/init.d/aria2 start } Update_aria2(){ @@ -566,20 +555,17 @@ Uninstall_aria2(){ read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then - crontab -l > "$file_1/crontab.bak" - sed -i "/aria2.sh/d" "$file_1/crontab.bak" - crontab "$file_1/crontab.bak" - rm -f "$file_1/crontab.bak" + crontab -l > "/tmp/crontab.bak" + sed -i "/aria2.sh/d" "/tmp/crontab.bak" + sed -i "/tracker.sh/d" "/tmp/crontab.bak" + crontab "/tmp/crontab.bak" + rm -f "/tmp/crontab.bak" check_pid [[ ! -z $PID ]] && kill -9 ${PID} Read_config "un" Del_iptables Save_iptables - cd "${Folder}" - make uninstall - cd .. rm -rf "${aria2c}" - rm -rf "${Folder}" rm -rf "${file}" if [[ ${release} = "centos" ]]; then chkconfig --del aria2 @@ -627,10 +613,7 @@ Update_Shell(){ wget -N "https://raw.githubusercontent.com/P3TERX/aria2.sh/master/aria2.sh" && chmod +x aria2.sh echo -e "脚本已更新为最新版本[ ${sh_new_ver} ] !(注意:因为更新方式为直接覆盖当前运行的脚本,所以可能下面会提示一些报错,无视即可)" && exit 0 } -action=$1 -if [[ "${action}" == "update-bt-tracker" ]]; then - Update_bt_tracker_cron -else + echo && echo -e " Aria2 一键安装管理脚本 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix} -- \033[1;35mP3TERX.COM\033[0m -- @@ -699,13 +682,13 @@ case "$num" in Clean_Log ;; 11) - Update_bt_tracker_cron + Update_bt_tracker ;; 12) - Update_bt_tracker + Update_bt_tracker_cron ;; *) echo "请输入正确数字 [0-12]" ;; esac -fi + diff --git a/service/aria2_centos b/service/aria2_centos index 7192fc2..91871d1 100644 --- a/service/aria2_centos +++ b/service/aria2_centos @@ -1,9 +1,6 @@ #!/usr/bin/env bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH # chkconfig: 2345 90 10 # description: aria2 is a lightweight multi-protocol & multi-source command-line download utility. - ### BEGIN INIT INFO # Provides: aria2 is a lightweight multi-protocol & multi-source command-line download utility. # Required-Start: $network $syslog @@ -14,14 +11,20 @@ export PATH # Description: Start or stop the Aria2 ### END INIT INFO +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH NAME="Aria2" NAME_BIN="aria2c" CONFIG="/root/.aria2/aria2.conf" LOG="/root/.aria2/aria2.log" -Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" -Info="${Green_font_prefix}[信息]${Font_color_suffix}" -Error="${Red_font_prefix}[错误]${Font_color_suffix}" +Green_font_prefix="\033[32m" +Red_font_prefix="\033[31m" +Green_background_prefix="\033[42;37m" +Red_background_prefix="\033[41;37m" +Font_color_suffix="\033[0m" +Info="[${Green_font_prefix}信息${Font_color_suffix}]" +Error="[${Red_font_prefix}错误${Font_color_suffix}]" RETVAL=0 check_running(){ @@ -70,7 +73,7 @@ do_start(){ else echo -e "${Info} $NAME 启动中..." ulimit -n 51200 - nohup aria2c -c "${CONFIG}" >> "${LOG}" 2>&1 & + nohup aria2c >> "${LOG}" 2>&1 & sleep 2s check_running if [[ $? -eq 0 ]]; then diff --git a/service/aria2_debian b/service/aria2_debian index f23f924..493e118 100644 --- a/service/aria2_debian +++ b/service/aria2_debian @@ -1,7 +1,4 @@ #!/usr/bin/env bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - ### BEGIN INIT INFO # Provides: aria2 is a lightweight multi-protocol & multi-source command-line download utility. # Required-Start: $network $local_fs $remote_fs @@ -12,14 +9,20 @@ export PATH # Description: Start or stop the Aria2 ### END INIT INFO +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH NAME="Aria2" NAME_BIN="aria2c" CONFIG="/root/.aria2/aria2.conf" LOG="/root/.aria2/aria2.log" -Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" -Info="${Green_font_prefix}[信息]${Font_color_suffix}" -Error="${Red_font_prefix}[错误]${Font_color_suffix}" +Green_font_prefix="\033[32m" +Red_font_prefix="\033[31m" +Green_background_prefix="\033[42;37m" +Red_background_prefix="\033[41;37m" +Font_color_suffix="\033[0m" +Info="[${Green_font_prefix}信息${Font_color_suffix}]" +Error="[${Red_font_prefix}错误${Font_color_suffix}]" RETVAL=0 check_running(){ @@ -68,7 +71,7 @@ do_start(){ else echo -e "${Info} $NAME 启动中..." ulimit -n 51200 - nohup aria2c -c "${CONFIG}" >> "${LOG}" 2>&1 & + nohup aria2c >> "${LOG}" 2>&1 & sleep 2s check_running if [[ $? -eq 0 ]]; then