Skip to content

Commit

Permalink
Update vps_scripts.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
everett7623 authored Jun 25, 2024
1 parent 66f1b4a commit 3c9feb4
Showing 1 changed file with 225 additions and 49 deletions.
274 changes: 225 additions & 49 deletions vps_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[1;34m'
PURPLE='\033[0;35m' # 紫色
WHITE='\033[1;37m' # 白色
NC='\033[0m' # No Color

# 定义渐变颜色数组
colors=(
'\033[38;2;0;255;0m' # 绿色
'\033[38;2;64;255;0m'
'\033[38;2;128;255;0m'
'\033[38;2;192;255;0m'
'\033[38;2;255;255;0m' # 黄色
'\033[38;2;255;192;0m'
'\033[38;2;255;128;0m'
'\033[38;2;255;64;0m'
'\033[38;2;255;0;0m' # 红色
)

# 检查 root 权限
Expand Down Expand Up @@ -124,74 +131,243 @@ echo "依赖项安装完成。"
while true; do
echo ""
echo "请选择要执行的脚本:"
echo -e "${YELLOW}1) 更新系统${NC}"
echo -e "${YELLOW}2) Yabs${NC}"
echo -e "${YELLOW}3) 融合怪${NC}"
echo -e "${YELLOW}4) IP质量${NC}"
echo -e "${YELLOW}5) 流媒体解锁${NC}"
echo -e "${YELLOW}6) 响应测试${NC}"
echo -e "${YELLOW}7) 三网测速(多/单线程)${NC}"
echo -e "${YELLOW}8) 安装并启动iperf3服务端 ${NC}"
echo -e "${YELLOW}9) AutoTrace三网回程路由${NC}"
echo -e "${YELLOW}10) 超售测试${NC}"
echo -e "${YELLOW}11) VPS一键脚本工具箱${NC}"
echo -e "${YELLOW}12) jcnf 常用脚本工具包${NC}"
echo -e "${YELLOW}13) 科技lion脚本${NC}"
echo -e "${YELLOW}14) BlueSkyXN脚本${NC}"
echo -e "${YELLOW}15) 勇哥Singbox${NC}"
echo -e "${YELLOW}16) 勇哥x-ui${NC}"
echo -e "${YELLOW}17) Fscarmen-Singbox${NC}"
echo -e "${YELLOW}18) Mack-a八合一${NC}"
echo -e "${YELLOW}19) Warp集合${NC}"
echo -e "${YELLOW}20) 安装docker${NC}"
echo -e "${YELLOW}21) 卸载脚本${NC}"
echo -e "${YELLOW}1) 本机信息${NC}"
echo -e "${YELLOW}2) 更新系统${NC}"
echo -e "${YELLOW}3) 清理系统${NC}"
echo -e "${YELLOW}4) Yabs${NC}"
echo -e "${YELLOW}5) 融合怪${NC}"
echo -e "${YELLOW}6) IP质量${NC}"
echo -e "${YELLOW}7) 流媒体解锁${NC}"
echo -e "${YELLOW}8) 响应测试${NC}"
echo -e "${YELLOW}9) 三网测速(多/单线程)${NC}"
echo -e "${YELLOW}10) 安装并启动iperf3服务端 ${NC}"
echo -e "${YELLOW}11) AutoTrace三网回程路由${NC}"
echo -e "${YELLOW}12) 超售测试${NC}"
echo -e "${YELLOW}20) VPS一键脚本工具箱${NC}"
echo -e "${YELLOW}21) jcnf 常用脚本工具包${NC}"
echo -e "${YELLOW}22) 科技lion脚本${NC}"
echo -e "${YELLOW}23) BlueSkyXN脚本${NC}"
echo -e "${YELLOW}30) 勇哥Singbox${NC}"
echo -e "${YELLOW}31) 勇哥x-ui${NC}"
echo -e "${YELLOW}32) Fscarmen-Singbox${NC}"
echo -e "${YELLOW}33) Mack-a八合一${NC}"
echo -e "${YELLOW}34) Warp集合${NC}"
echo -e "${YELLOW}40) 安装docker${NC}"
echo -e "${YELLOW}99) 卸载脚本${NC}"
echo -e "${YELLOW}0) 退出${NC}"

read -p "输入数字选择对应的脚本: " choice

case $choice in
1)
1)
clear
echo -e "${YELLOW}执行本机信息...${NC}"

ipv4_address=$(curl -s http://ipinfo.io/ip)
ipv6_address=$(curl -s http://ip6.me/ | awk -F "[<,>]" '/ip_address/{print $3}')

if [ "$(uname -m)" == "x86_64" ]; then
cpu_info=$(cat /proc/cpuinfo | grep 'model name' | uniq | sed -e 's/model name[[:space:]]*: //')
else
cpu_info=$(lscpu | grep 'Model name' | sed -e 's/Model name[[:space:]]*: //')
fi

cpu_usage=$(top -bn1 | grep 'Cpu(s)' | awk '{print $2 + $4}')
cpu_usage_percent=$(printf "%.2f" "$cpu_usage")%

cpu_cores=$(nproc)

mem_info=$(free -b | awk 'NR==2{printf "%.2f/%.2f MB (%.2f%%)", $3/1024/1024, $2/1024/1024, $3*100/$2}')

disk_info=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)", $3,$2,$5}')

country=$(curl -s ipinfo.io/country)
city=$(curl -s ipinfo.io/city)

isp_info=$(curl -s ipinfo.io/org)

cpu_arch=$(uname -m)

hostname=$(hostname)

kernel_version=$(uname -r)

congestion_algorithm=$(sysctl -n net.ipv4.tcp_congestion_control)
queue_algorithm=$(sysctl -n net.core.default_qdisc)

# 尝试使用 lsb_release 获取系统信息
os_info=$(lsb_release -ds 2>/dev/null)

# 如果 lsb_release 命令失败,则尝试其他方法
if [ -z "$os_info" ]; then
# 检查常见的发行文件
if [ -f "/etc/os-release" ]; then
os_info=$(source /etc/os-release && echo "$PRETTY_NAME")
elif [ -f "/etc/debian_version" ]; then
os_info="Debian $(cat /etc/debian_version)"
elif [ -f "/etc/redhat-release" ]; then
os_info=$(cat /etc/redhat-release)
else
os_info="Unknown"
fi
fi

clear
echo -e "${YELLOW}执行系统更新...${NC}"
(sudo apt update && sudo apt upgrade -y) &
pid=$!
while kill -0 $pid 2>/dev/null; do
echo -n "."
sleep 1
done
echo "更新完成"
output=$(awk 'BEGIN { rx_total = 0; tx_total = 0 }
NR > 2 { rx_total += $2; tx_total += $10 }
END {
rx_units = "Bytes";
tx_units = "Bytes";
if (rx_total > 1024) { rx_total /= 1024; rx_units = "KB"; }
if (rx_total > 1024) { rx_total /= 1024; rx_units = "MB"; }
if (rx_total > 1024) { rx_total /= 1024; rx_units = "GB"; }
if (tx_total > 1024) { tx_total /= 1024; tx_units = "KB"; }
if (tx_total > 1024) { tx_total /= 1024; tx_units = "MB"; }
if (tx_total > 1024) { tx_total /= 1024; tx_units = "GB"; }
printf("总接收: %.2f %s\n总发送: %.2f %s\n", rx_total, rx_units, tx_total, tx_units);
}' /proc/net/dev)


current_time=$(date "+%Y-%m-%d %I:%M %p")

swap_used=$(free -m | awk 'NR==3{print $3}')
swap_total=$(free -m | awk 'NR==3{print $2}')

if [ "$swap_total" -eq 0 ]; then
swap_percentage=0
else
swap_percentage=$((swap_used * 100 / swap_total))
fi

swap_info="${swap_used}MB/${swap_total}MB (${swap_percentage}%)"

runtime=$(cat /proc/uptime | awk -F. '{run_days=int($1 / 86400);run_hours=int(($1 % 86400) / 3600);run_minutes=int(($1 % 3600) / 60); if (run_days > 0) printf("%d天 ", run_days); if (run_hours > 0) printf("%d时 ", run_hours); printf("%d分\n", run_minutes)}')

echo ""
echo -e "${WHITE}系统信息详情${NC}"
echo "------------------------"
echo -e "${WHITE}主机名: ${PURPLE}${hostname}${NC}"
echo -e "${WHITE}运营商: ${PURPLE}${isp_info}${NC}"
echo "------------------------"
echo -e "${WHITE}系统版本: ${PURPLE}${os_info}${NC}"
echo -e "${WHITE}Linux版本: ${PURPLE}${kernel_version}${NC}"
echo "------------------------"
echo -e "${WHITE}CPU架构: ${PURPLE}${cpu_arch}${NC}"
echo -e "${WHITE}CPU型号: ${PURPLE}${cpu_info}${NC}"
echo -e "${WHITE}CPU核心数: ${PURPLE}${cpu_cores}${NC}"
echo "------------------------"
echo -e "${WHITE}CPU占用: ${PURPLE}${cpu_usage_percent}${NC}"
echo -e "${WHITE}物理内存: ${PURPLE}${mem_info}${NC}"
echo -e "${WHITE}虚拟内存: ${PURPLE}${swap_info}${NC}"
echo -e "${WHITE}硬盘占用: ${PURPLE}${disk_info}${NC}"
echo "------------------------"
echo -e "${PURPLE}$output${NC}"
echo "------------------------"
echo -e "${WHITE}网络拥堵算法: ${PURPLE}${congestion_algorithm} ${queue_algorithm}${NC}"
echo "------------------------"
echo -e "${WHITE}公网IPv4地址: ${PURPLE}${ipv4_address}${NC}"
echo -e "${WHITE}公网IPv6地址: ${PURPLE}${ipv6_address}${NC}"
echo "------------------------"
echo -e "${WHITE}地理位置: ${PURPLE}${country} ${city}${NC}"
echo -e "${WHITE}系统时间: ${PURPLE}${current_time}${NC}"
echo "------------------------"
echo -e "${WHITE}系统运行时长: ${PURPLE}${runtime}${NC}"
echo
;;
2)
clear
echo -e "${YELLOW}执行 更新系统...${NC}"
update_system() {
if command -v apt &>/dev/null; then
apt-get update && apt-get upgrade -y
elif command -v dnf &>/dev/null; then
dnf check-update && dnf upgrade -y
elif command -v yum &>/dev/null; then
yum check-update && yum upgrade -y
elif command -v apk &>/dev/null; then
apk update && apk upgrade
else
echo -e "${RED}不支持的Linux发行版${NC}"
return 1
fi
return 0
}
update_system
;;
3)
clear
echo -e "${YELLOW}执行 清理系统...${NC}"
clean_system() {
if command -v apt &>/dev/null; then
apt autoremove --purge -y && apt clean -y && apt autoclean -y
apt remove --purge $(dpkg -l | awk '/^rc/ {print $2}') -y
# 清理日志
journalctl --vacuum-time=1s
journalctl --vacuum-size=50M
# 移除不再需要的内核
apt remove --purge $(dpkg -l | awk '/^ii linux-(image|headers)-[^ ]+/{print $2}' | grep -v $(uname -r | sed 's/-.*//') | xargs) -y
elif command -v yum &>/dev/null; then
yum autoremove -y && yum clean all
# 清理日志
journalctl --vacuum-time=1s
journalctl --vacuum-size=50M
# 移除不再需要的内核
yum remove $(rpm -q kernel | grep -v $(uname -r)) -y
elif command -v dnf &>/dev/null; then
dnf autoremove -y && dnf clean all
# 清理日志
journalctl --vacuum-time=1s
journalctl --vacuum-size=50M
# 移除不再需要的内核
dnf remove $(rpm -q kernel | grep -v $(uname -r)) -y
elif command -v apk &>/dev/null; then
apk autoremove -y
apk clean
# 清理日志文件
journalctl --vacuum-time=1s
journalctl --vacuum-size=50M
# 移除不再需要的内核
apk del $(apk info -e | grep '^r' | awk '{print $1}') -y
else
echo -e "${RED}暂不支持你的系统!${NC}"
exit 1
fi
}
clean_system
;;
4)
clear
echo -e "${YELLOW}执行 Yabs 脚本...${NC}"
wget -qO- yabs.sh | bash
;;
3)
5)
clear
echo -e "${YELLOW}执行 融合怪 脚本...${NC}"
curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh
;;
4)
6)
clear
echo -e "${YELLOW}执行 IP质量 脚本...${NC}"
bash <(curl -Ls IP.Check.Place)
;;
5)
7)
clear
echo -e "${YELLOW}执行 流媒体解锁 脚本...${NC}"
bash <(curl -L -s media.ispvps.com)
;;
6)
8)
clear
echo -e "${YELLOW}执行 响应测试 脚本...${NC}"
bash <(curl -sL https://nodebench.mereith.com/scripts/curltime.sh)
;;
7)
9)
clear
echo -e "${YELLOW}执行 三网测速(多/单线程) 脚本...${NC}"
bash <(curl -sL bash.icu/speedtest)
;;
8)
10)
clear
echo -e "${YELLOW}执行 安装并启动iperf3服务端 脚本...${NC}"
echo ""
Expand Down Expand Up @@ -248,67 +424,67 @@ while true; do
apt-get install -y iperf3
iperf3 -s
;;
9)
11)
clear
echo -e "${YELLOW}执行 AutoTrace三网回程路由 脚本...${NC}"
wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh
;;
10)
12)
clear
echo -e "${YELLOW}执行 超售测试脚本 脚本...${NC}"
wget --no-check-certificate -O memoryCheck.sh https://raw.githubusercontent.com/uselibrary/memoryCheck/main/memoryCheck.sh && chmod +x memoryCheck.sh && bash memoryCheck.sh
;;
11)
20)
clear
echo -e "${YELLOW}执行 VPS一键脚本工具箱 脚本...${NC}"
curl -fsSL https://raw.githubusercontent.com/eooce/ssh_tool/main/ssh_tool.sh -o ssh_tool.sh && chmod +x ssh_tool.sh && ./ssh_tool.sh
;;
12)
21)
clear
echo -e "${YELLOW}执行 jcnf 常用脚本工具包 脚本...${NC}"
wget -O jcnfbox.sh https://raw.githubusercontent.com/Netflixxp/jcnf-box/main/jcnfbox.sh && chmod +x jcnfbox.sh && clear && ./jcnfbox.sh
;;
13)
22)
clear
echo -e "${YELLOW}执行 科技lion脚本 脚本...${NC}"
curl -sS -O https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh
;;
14)
23)
clear
echo -e "${YELLOW}执行 BlueSkyXN脚本 脚本...${NC}"
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh
;;
15)
30)
clear
echo -e "${YELLOW}执行 勇哥Singbox 脚本...${NC}"
bash <(curl -Ls https://gitlab.com/rwkgyg/sing-box-yg/raw/main/sb.sh)
;;
16)
31)
clear
echo -e "${YELLOW}执行 勇哥x-ui 脚本...${NC}"
bash <(curl -Ls https://gitlab.com/rwkgyg/x-ui-yg/raw/main/install.sh)
;;
17)
32)
clear
echo -e "${YELLOW}执行 Fscarmen-Singbox 脚本...${NC}"
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sba/main/sba.sh)
;;
18)
33)
clear
echo -e "${YELLOW}执行 Mack-a八合一 脚本...${NC}"
wget -P /root -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" && chmod 700 /root/install.sh && /root/install.sh
;;
19)
34)
clear
echo -e "${YELLOW}执行 Warp集合 脚本...${NC}"
bash <(curl -sSL https://gitlab.com/fscarmen/warp_unlock/-/raw/main/unlock.sh)
;;
20)
40)
clear
echo -e "${YELLOW}执行 安装docker 脚本...${NC}"
curl -fsSL https://get.docker.com | bash -s docker
;;
21)
99)
clear
echo -e "${YELLOW}执行 卸载脚本...${NC}"

Expand Down

0 comments on commit 3c9feb4

Please sign in to comment.