From f5d4bae4a843da13b414990d29ef29d110078f85 Mon Sep 17 00:00:00 2001 From: charles <531297669@qq.com> Date: Fri, 14 Jan 2022 20:39:19 +0800 Subject: [PATCH] update tools.sh --- scripts/tools.sh | 56 +++++++++++++++++++++++++++++---------- scripts/tools_cdn.sh | 62 ++++++++++++++++++++++++++++++++------------ 2 files changed, 89 insertions(+), 29 deletions(-) diff --git a/scripts/tools.sh b/scripts/tools.sh index c3674d1..0450f79 100644 --- a/scripts/tools.sh +++ b/scripts/tools.sh @@ -29,9 +29,11 @@ install() { case $choose in 1) wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy +# wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy ;; 2) wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy +# wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy ;; *) echo "请输入正确的数字" @@ -40,10 +42,10 @@ install() { chmod 777 /root/miner_proxy/minerProxy wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/scripts/run.sh -O /root/miner_proxy/run.sh +# wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/scripts/run.sh -O /root/miner_proxy/run.sh chmod 777 /root/miner_proxy/run.sh echo "如果没有报错则安装成功" echo "正在启动..." - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -81,9 +83,11 @@ update() { case $choose in 1) wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy +# wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy ;; 2) wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy +# wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy ;; *) echo "请输入正确的数字" @@ -101,7 +105,6 @@ update() { echo "删除配置文件成功" fi fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -112,14 +115,13 @@ update() { sleep 1s cat /root/miner_proxy/config.yml echo "请记录您的token和端口 并打开 http://服务器ip:端口 访问web服务进行配置" - echo "已启动web后台 您可运行 screen -r minerProxy 查看程序輸出" + echo "您可运行 screen -r minerProxy 查看程序輸出" } start() { if screen -list | grep -q "minerProxy"; then echo -e "minerProxy已启动,请勿重复启动" && exit 1 fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -135,7 +137,6 @@ restart() { if screen -list | grep -q "minerProxy"; then screen -X -S minerProxy quit fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -144,6 +145,7 @@ restart() { screen -r minerProxy -p 0 -X stuff $'\n' echo "minerProxy 重新启动成功" + echo "您可运行 screen -r minerProxy 查看程序輸出" } stop() { @@ -153,17 +155,39 @@ stop() { echo "minerProxy 已停止" } +change_limit(){ + num="n" + if [ $(grep -c "root soft nofile" /etc/security/limits.conf) -eq '0' ]; then + echo "root soft nofile 102400" >>/etc/security/limits.conf + num="y" + fi + + if [[ "$num" = "y" ]]; then + echo "连接数限制已修改为102400,重启服务器后生效" + else + echo -n "当前连接数限制:" + ulimit -n + fi +} + +check_limit(){ + echo -n "当前连接数限制:" + ulimit -n +} + echo "=======================================================" echo "Char1esOrz的minerProxy 一键工具" -echo " 1、安 装(默认安装到/root/minerProxy)" -echo " 2、卸 载" -echo " 3、更 新" -echo " 4、启 动" -echo " 5、重 启" -echo " 6、停 止" -#echo " 7、配置开机启动" +echo " 1、安装(默认安装到/root/minerProxy)" +echo " 2、卸载" +echo " 3、更新" +echo " 4、启动" +echo " 5、重启" +echo " 6、停止" +echo " 7、解除linux系统连接数限制(需要重启服务器生效)" +echo " 8、查看当前系统连接数限制" +#echo " 9、配置开机启动" echo "=======================================================" -read -p "$(echo -e "请选择[1-6]:")" choose +read -p "$(echo -e "请选择[1-8]:")" choose case $choose in 1) install @@ -183,6 +207,12 @@ case $choose in 6) stop ;; +7) + change_limit + ;; +8) + check_limit + ;; *) echo "输入错误请重新输入!" ;; diff --git a/scripts/tools_cdn.sh b/scripts/tools_cdn.sh index efdc2be..848f848 100644 --- a/scripts/tools_cdn.sh +++ b/scripts/tools_cdn.sh @@ -28,9 +28,11 @@ install() { read -p "$(echo -e "请输入[1-2]:")" choose case $choose in 1) +# wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy ;; 2) +# wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy ;; *) @@ -39,11 +41,11 @@ install() { esac chmod 777 /root/miner_proxy/minerProxy +# wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/scripts/run.sh -O /root/miner_proxy/run.sh wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/scripts/run.sh -O /root/miner_proxy/run.sh chmod 777 /root/miner_proxy/run.sh echo "如果没有报错则安装成功" echo "正在启动..." - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -74,15 +76,17 @@ update() { screen -X -S minerProxy quit fi rm -rf /root/miner_proxy/minerProxy - echo "请选择测试版还是稳定版" - echo " 1、稳定版" - echo " 2、测试版" + echo "请选择V3.0.3版本还是V4.0.0版本" + echo " 1、V3.0.3" + echo " 2、V4.0.0" read -p "$(echo -e "请输入[1-2]:")" choose case $choose in 1) +# wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v3.0.3/minerProxy_web -O /root/miner_proxy/minerProxy ;; 2) +# wget https://raw.githubusercontent.com/Char1esOrz/minerProxy/master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy wget https://cdn.jsdelivr.net/gh/Char1esOrz/minerProxy@master/release/v4.0.0T8/minerProxy_v4.0.0T8_linux_amd64 -O /root/miner_proxy/minerProxy ;; *) @@ -101,7 +105,6 @@ update() { echo "删除配置文件成功" fi fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -112,14 +115,13 @@ update() { sleep 1s cat /root/miner_proxy/config.yml echo "请记录您的token和端口 并打开 http://服务器ip:端口 访问web服务进行配置" - echo "已启动web后台 您可运行 screen -r minerProxy 查看程序輸出" + echo "您可运行 screen -r minerProxy 查看程序輸出" } start() { if screen -list | grep -q "minerProxy"; then echo -e "minerProxy已启动,请勿重复启动" && exit 1 fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -135,7 +137,6 @@ restart() { if screen -list | grep -q "minerProxy"; then screen -X -S minerProxy quit fi - ulimit -n 102400 screen -dmS minerProxy sleep 0.2s screen -r minerProxy -p 0 -X stuff "cd /root/miner_proxy" @@ -144,6 +145,7 @@ restart() { screen -r minerProxy -p 0 -X stuff $'\n' echo "minerProxy 重新启动成功" + echo "您可运行 screen -r minerProxy 查看程序輸出" } stop() { @@ -153,17 +155,39 @@ stop() { echo "minerProxy 已停止" } +change_limit(){ + num="n" + if [ $(grep -c "root soft nofile" /etc/security/limits.conf) -eq '0' ]; then + echo "root soft nofile 102400" >>/etc/security/limits.conf + num="y" + fi + + if [[ "$num" = "y" ]]; then + echo "连接数限制已修改为102400,重启服务器后生效" + else + echo -n "当前连接数限制:" + ulimit -n + fi +} + +check_limit(){ + echo -n "当前连接数限制:" + ulimit -n +} + echo "=======================================================" echo "Char1esOrz的minerProxy 一键工具" -echo " 1、安 装(默认安装到/root/minerProxy)" -echo " 2、卸 载" -echo " 3、更 新" -echo " 4、启 动" -echo " 5、重 启" -echo " 6、停 止" -#echo " 7、配置开机启动" +echo " 1、安装(默认安装到/root/minerProxy)" +echo " 2、卸载" +echo " 3、更新" +echo " 4、启动" +echo " 5、重启" +echo " 6、停止" +echo " 7、解除linux系统连接数限制(需要重启服务器生效)" +echo " 8、查看当前系统连接数限制" +#echo " 9、配置开机启动" echo "=======================================================" -read -p "$(echo -e "请选择[1-6]:")" choose +read -p "$(echo -e "请选择[1-8]:")" choose case $choose in 1) install @@ -183,6 +207,12 @@ case $choose in 6) stop ;; +7) + change_limit + ;; +8) + check_limit + ;; *) echo "输入错误请重新输入!" ;;