Skip to content

Commit

Permalink
update tools.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
charles committed Jan 14, 2022
1 parent 9f15e4b commit f5d4bae
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 29 deletions.
56 changes: 43 additions & 13 deletions scripts/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "请输入正确的数字"
Expand All @@ -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"
Expand Down Expand Up @@ -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 "请输入正确的数字"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -144,6 +145,7 @@ restart() {
screen -r minerProxy -p 0 -X stuff $'\n'

echo "minerProxy 重新启动成功"
echo "您可运行 screen -r minerProxy 查看程序輸出"
}

stop() {
Expand All @@ -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
Expand All @@ -183,6 +207,12 @@ case $choose in
6)
stop
;;
7)
change_limit
;;
8)
check_limit
;;
*)
echo "输入错误请重新输入!"
;;
Expand Down
62 changes: 46 additions & 16 deletions scripts/tools_cdn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
*)
Expand All @@ -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"
Expand Down Expand Up @@ -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
;;
*)
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -144,6 +145,7 @@ restart() {
screen -r minerProxy -p 0 -X stuff $'\n'

echo "minerProxy 重新启动成功"
echo "您可运行 screen -r minerProxy 查看程序輸出"
}

stop() {
Expand All @@ -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
Expand All @@ -183,6 +207,12 @@ case $choose in
6)
stop
;;
7)
change_limit
;;
8)
check_limit
;;
*)
echo "输入错误请重新输入!"
;;
Expand Down

0 comments on commit f5d4bae

Please sign in to comment.