科技Lion 的 Shell 脚本工具
介绍 (Introduction)
科技Lion 的 Shell 脚本工具是一款全能脚本工具箱,专为 Linux 监控、测试和管理而设计。无论您是初学者还是经验丰富的用户,该工具都能为您提供便捷的解决方案。集成了独创的 Docker 管理功能,让您轻松管理容器化应用;LNMP建站解决方案能帮助您快速搭建网站,站点优化、防御、备份还原迁移一应俱全;并且整合了各类系统工具面板的安装及使用,使系统维护变得更加简单。我们的目标是成为全网最优秀的 Linux 一键脚本工具,为用户提供高效、便捷的科技支持。
KejiLion’s Shell script tool is an all-in-one script toolbox designed for Linux monitoring, testing, and management. Whether you are a beginner or an experienced user, this tool offers convenient solutions. It integrates unique Docker management features, enabling easy containerized application management. The LNMP site-building solution helps you quickly set up websites, covering optimization, defense, backup, restoration, and migration. It also includes the installation and use of various system tool panels, making system maintenance simpler. Our goal is to become the best Linux one-click script tool on the internet, providing users with efficient and convenient tech support.
支持系统 (Supported Systems)
一键安装 (One-Click Installation) CN
bash <(curl -sL kejilion.sh)
一键安装 (One-Click Installation) EN
bash <(curl -sL kejilion.sh) en
效果图预览 (Preview)
核心功能 (Core Features)
-
系统信息概览:快速展示 CPU、内存、磁盘、带宽等运行状态
System status overview: CPU, memory, disk, bandwidth and more -
网络测试工具:集成测速、回程、延迟、丢包检测等
Network tools: speed test, route trace, latency, packet loss test -
Docker 容器管理:独家容器可视化 + 容器控制增强命令
Advanced Docker management with enhanced commands and visualization -
LNMP 一键部署:轻松搭建 Nginx + MySQL + PHP 站点
One-click LNMP stack deployment (Nginx, MySQL, PHP) -
网站防御与优化:防CC、防爬虫,自动配置防火墙与性能优化
Site defense and optimization: anti-CC, anti-crawler, firewall and tuning -
备份与迁移:站点与数据库一键备份/恢复/远程迁移
Backup & migration: one-click site/database backup and remote restore -
BBR 加速优化:内核加速、网络拥塞控制智能切换
Network acceleration: BBR/tcp congestion control optimization -
应用市场集成:内置主流工具与面板,支持一键安装常用服务
App Store integration: built-in panels and tools for one-click deployment -
自动更新机制:定时检测脚本版本,保持最新最稳定
Auto-update engine: ensure you’re always running the latest version
Eooce vps一键脚本工具
集成各种vps常用工具,去掉繁琐操作,加入常用节点搭建脚本合集,一键母鸡开nat小鸡,一建脚本搞定所有
vps一键脚本工具 的支持列表:
Debian Ubuntu CentOS Alpine Fedora Rocky-linux Amazom-linux Oracle-linux
一键脚本
bash <(curl -fsSL ssh_tool.eooce.com)
- 若提示没有curl或wget,先安装即可
- Ubuntu/Debian:apt-get install -y curl wget
- Alpine:apk add curl wget
- Fedora:dnf install -y curl wget
- CentOS/Rocky/Almalinux/Oracle-linux/Amazon-linux:yum install -y curl wget
Docker Compose 项目每日自动更新一键脚本
#!/usr/bin/env bash
set -euo pipefail
IFS=
sing-box-yg 专用的 SOCKS5 一键部署脚本
# sing-box-yg 专用:复制这一个块,粘贴进终端即可完成 “SOCKS5 入站 → direct 出站” 独立服务
# 适用:已安装 https://github.com/yonggekkk/sing-box-yg 的 VPS(定制二进制通常在 /etc/s-box/sing-box)
# 用法:
# 1) 如需改端口/账号/监听地址,只需改动最上面的四个变量即可;其余保持不变。
# 2) 选中**整段**复制,粘贴到服务器终端回车执行。
# ======= 可按需修改的 4 个变量 =======
LISTEN_ADDR="0.0.0.0" # 若仅本机使用改为 127.0.0.1
SOCKS_PORT=41233 # 端口可改为未占用的,如 41234
SOCKS_USER="ryanvan" # Socks5 用户名
SOCKS_PASS=" " # Socks5 密码
# ======= 以下内容无需改动,直接粘贴执行 =======
CFG_PATH="/etc/sing-box/socks.json"; UNIT_PATH="/etc/systemd/system/sing-box-socks.service"
SING_BOX_BIN=""; for c in \
"/etc/s-box/sing-box" \
"$(command -v sing-box 2>/dev/null || true)" \
"/usr/local/bin/sing-box" \
"/usr/bin/sing-box"; do [ -n "$c" ] && [ -x "$c" ] && SING_BOX_BIN="$c" && break; done; \
if [ -z "$SING_BOX_BIN" ]; then echo "[ERR] 未找到 sing-box 可执行文件,请先在 sb 面板(选项 8)安装/切换内核" >&2; exit 1; fi; \
sudo mkdir -p /etc/sing-box; \
sudo tee "$CFG_PATH" >/dev/null <<EOF
{
"log": { "level": "info" },
"inbounds": [{
"type": "socks",
"tag": "socks-in",
"listen": "$LISTEN_ADDR",
"listen_port": $SOCKS_PORT,
"users": [{ "username": "$SOCKS_USER", "password": "$SOCKS_PASS" }]
}],
"outbounds": [{ "type": "direct", "tag": "direct" }],
"route": { "rules": [{ "inbound": ["socks-in"], "outbound": "direct" }] }
}
EOF
sudo "$SING_BOX_BIN" check -c "$CFG_PATH"; \
sudo tee "$UNIT_PATH" >/dev/null <<EOF
[Unit]
Description=Sing-box SOCKS-only (yg) service
After=network.target
[Service]
ExecStart=$SING_BOX_BIN run -c $CFG_PATH
Restart=always
User=root
LimitNOFILE=1048576
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload; \
sudo systemctl enable --now sing-box-socks; \
sleep 0.5; \
sudo systemctl status sing-box-socks --no-pager -l || true; \
if command -v ss >/dev/null 2>&1; then ss -lntp | grep ":$SOCKS_PORT" || true; fi; \
echo "
[OK] SOCKS5 已部署:$LISTEN_ADDR:$SOCKS_PORT 用户: $SOCKS_USER 密码: $SOCKS_PASS"; \
echo "提示:如需限制来源 IP,请执行:sudo ufw allow from <你的公网IP> to any port $SOCKS_PORT proto tcp";
设置虚拟内存一键脚本
# 需 root
cat >/root/init-swap-zram512.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
# ================== 可调参数 ==================
SWAP_FILE=${SWAP_FILE:-/swapfile.new} # 磁盘swap路径
SWAP_SIZE=${SWAP_SIZE:-3G} # 磁盘swap大小
ZRAM_TARGET_MIB=${ZRAM_TARGET_MIB:-512} # 目标 zram 大小(MiB)
ZRAM_PRIORITY=${ZRAM_PRIORITY:-100} # zram 优先级
DISKSWAP_PRIORITY=${DISKSWAP_PRIORITY:-0} # 磁盘swap优先级
# =============================================
log() { echo -e "\e[32m[INFO]\e[0m $*"; }
warn(){ echo -e "\e[33m[WARN]\e[0m $*"; }
err() { echo -e "\e[31m[ERR ]\e[0m $*" >&2; }
[ "$(id -u)" -eq 0 ] || { err "请以 root 运行"; exit 1; }
export DEBIAN_FRONTEND=noninteractive
log "1/4 创建并启用 ${SWAP_SIZE} 磁盘Swap: ${SWAP_FILE}"
if [ ! -f "$SWAP_FILE" ]; then
if ! fallocate -l "$SWAP_SIZE" "$SWAP_FILE" 2>/dev/null; then
dd if=/dev/zero of="$SWAP_FILE" bs=1M count=$(( ${SWAP_SIZE%G} * 1024 )) status=progress
fi
fi
chmod 600 "$SWAP_FILE"
mkswap "$SWAP_FILE" >/dev/null 2>&1 || true
# 以指定优先级启用
```\n\t'
PATH=/usr/sbin:/usr/bin:/sbin:/bin
# === 配置:你的 Compose 项目目录 ===
DIRS=(
"/home/ryan/gemini-balance"
"/home/ryan/gpt-load"
)
# 如需连数据库服务也更新,把 SKIP_DB_SERVICES 改成 0
SKIP_DB_SERVICES=${SKIP_DB_SERVICES:-1}
# 避免并发(如果上一次没跑完)
exec 9>/var/run/compose-autoupdate.lock
flock -n 9 || { echo "Another run is in progress. Exit."; exit 0; }
# 解析 compose 命令(用数组避免空格问题)
declare -a COMPOSE
if docker compose version >/dev/null 2>&1; then
COMPOSE=(docker compose)
elif command -v docker-compose >/dev/null 2>&1; then
COMPOSE=(docker-compose)
else
echo "docker compose / docker-compose 未安装"; exit 1
fi
git_as_owner() {
local dir="$1"; shift
local owner
owner=$(stat -c '%U' "$dir" 2>/dev/null || echo "")
[ -z "$owner" ] && { echo "无法获取目录所有者:$dir"; return 1; }
sudo -u "$owner" git -C "$dir" "$@"
}
update_one() {
local d="$1"
echo -e "\n=============================="
echo ">>> 更新项目:$d @ $(date -Is)"
echo "=============================="
[ -d "$d" ] || { echo "目录不存在:$d"; return 1; }
cd "$d"
# 1) Git(有仓库且干净才 pull)
if [ -d .git ]; then
if ! git_as_owner "$d" diff --quiet || ! git_as_owner "$d" diff --cached --quiet; then
echo "⚠️ 检测到未提交改动,跳过 git pull:$d"
else
git_as_owner "$d" fetch --all --prune
local branch
branch=$(git_as_owner "$d" symbolic-ref --short HEAD 2>/dev/null || echo "")
if [ -n "$branch" ] && ! git_as_owner "$d" rev-parse --abbrev-ref --symbolic-full-name "@{u}" >/dev/null 2>&1; then
if git_as_owner "$d" ls-remote --exit-code --heads origin "$branch" >/dev/null 2>&1; then
git_as_owner "$d" branch --set-upstream-to "origin/$branch" "$branch" || true
fi
fi
if ! git_as_owner "$d" pull --ff-only; then
echo "⚠️ ff-only pull 失败(可能存在分叉),已跳过 pull。"
fi
fi
else
echo "ℹ️ 非 git 仓库,跳过 git。"
fi
# 2) Compose:只更新应用服务(默认跳过数据库类)
"${COMPOSE[@]}" config >/dev/null
local services
services=$("${COMPOSE[@]}" config --services)
if [ "${SKIP_DB_SERVICES}" = "1" ]; then
services=$(echo "$services" | grep -Ev '^(mysql|mariadb|db|postgres|redis)
2.sing-box-yg 专用的 SOCKS5 一键部署脚本
DISCOURSE_PLACEHOLDER_2
3. 设置虚拟内存一键脚本
DISCOURSE_PLACEHOLDER_3
``` || true)
fi
# 如果未匹配到(例如单服务项目),直接全量
if [ -z "$services" ]; then
services=$("${COMPOSE[@]}" config --services)
fi
echo "[Compose] 目标服务:"
echo "$services" | sed 's/^/ - /'
echo "[Compose] 拉取镜像…"
"${COMPOSE[@]}" pull $services
echo "[Compose] 滚动更新…"
"${COMPOSE[@]}" up -d --remove-orphans $services
echo "[Compose] 状态:"
"${COMPOSE[@]}" ps
echo "[Compose] 最近 80 行日志:"
"${COMPOSE[@]}" logs --tail 80 --no-log-prefix $services || true
echo "✅ 完成:$d"
}
for d in "${DIRS[@]}"; do
update_one "$d"
done
# 可选:清理悬挂镜像,避免磁盘涨太快
docker image prune -f >/dev/null 2>&1 || true
echo -e "\n🎉 自动更新完成:$(date -Is)"
2.sing-box-yg 专用的 SOCKS5 一键部署脚本
DISCOURSE_PLACEHOLDER_2
3. 设置虚拟内存一键脚本
DISCOURSE_PLACEHOLDER_3