From dafd5e7cf82a8941b1fb0eed6ddb470cbe3da6de Mon Sep 17 00:00:00 2001 From: mshe <666666666@666666666.666666666> Date: Thu, 28 May 2026 15:22:21 +0800 Subject: [PATCH] update start.sh --- sh/auto_install.sh | 11 ++++++++++- sh/install.sh | 16 ++++++---------- sh/start.sh | 2 +- sh/uninstall.sh | 10 +++++----- sh/update.sh | 6 +++--- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/sh/auto_install.sh b/sh/auto_install.sh index ce51d66..c4194e2 100644 --- a/sh/auto_install.sh +++ b/sh/auto_install.sh @@ -13,7 +13,16 @@ echo "下载卸载脚本..." wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/uninstall.sh && chmod +x uninstall.sh echo "下载完成" echo "开始安装..." -./install.sh + +USER_COUNT=10 +# 公共的工作目录 +PUBLIC_DIR="/shared" +# git仓库加速地址 +GIT_NO_VNC="https://git.nps.crabapples.cn/crabapples/noVNC.git" +GIT_WEBSOCKIFY="https://git.nps.crabapples.cn/crabapples/websockify.git" +GIT_PY_SPIDER="https://git.nps.crabapples.cn/crabapples/learn-spider.git" + +./install.sh $USER_COUNT $PUBLIC_DIR $GIT_NO_VNC $GIT_WEBSOCKIFY $GIT_PY_SPIDER echo "安装完成" diff --git a/sh/install.sh b/sh/install.sh index 4864451..0b983a7 100644 --- a/sh/install.sh +++ b/sh/install.sh @@ -2,17 +2,13 @@ # ==================== 配置变量 ==================== # 需要创建的用户数量 -USER_COUNT=10 +USER_COUNT=${1:-10} # 公共的工作目录 -PUBLIC_DIR="/shared" -# git仓库原地址 -GIT_NO_VNC_BAK="https://github.com/novnc/noVNC.git" -GIT_WEBSOCKIFY_BAK="https://github.com/novnc/websockify.git" -# git仓库加速地址 -GIT_NO_VNC="https://git.nps.crabapples.cn/crabapples/noVNC.git" -GIT_WEBSOCKIFY="https://git.nps.crabapples.cn/crabapples/websockify.git" -GIT_PY_SPIDER="https://git.nps.crabapples.cn/crabapples/learn-spider.git" - +PUBLIC_DIR="${2:-/shared}" +# git仓库地址 +GIT_NO_VNC="${3:-https://github.com/novnc/noVNC.git}" +GIT_WEBSOCKIFY="${4:-https://github.com/novnc/websockify.git}" +GIT_PY_SPIDER="${5:-https://git.nps.crabapples.cn/crabapples/learn-spider.git}" # ==================== 函数定义 ==================== # 1. 预安装软件 diff --git a/sh/start.sh b/sh/start.sh index 9075305..6f12440 100644 --- a/sh/start.sh +++ b/sh/start.sh @@ -1,6 +1,6 @@ #!/bin/bash -PUBLIC_DIR="/shared" INDEX=$1 +PUBLIC_DIR="${2:-/shared}" username="user$INDEX" export DISPLAY=:$INDEX echo "当前显示桌面:$DISPLAY" diff --git a/sh/uninstall.sh b/sh/uninstall.sh index 753e584..c18e2e9 100644 --- a/sh/uninstall.sh +++ b/sh/uninstall.sh @@ -1,7 +1,7 @@ #!/bin/bash -USER_COUNT=100 -PUBLIC_DIR="/shared" -SECOUND=5 +USER_COUNT="${1:-10}" +PUBLIC_DIR="${2:-/shared}" +SECOND="${3:-5}" batch_kill_process(){ echo "正在结束进程" @@ -27,9 +27,9 @@ batch_delete_user(){ echo "批量删除完成!" } -for i in $(seq 1 $SECOUND); do +for i in $(seq 1 $SECOND); do clear - echo "$(($SECOUND-$i))S后开始数据清理...." + echo "$(($SECOND-$i))S后开始数据清理...." sleep 1 done diff --git a/sh/update.sh b/sh/update.sh index 6d2d7a9..0eb22e2 100644 --- a/sh/update.sh +++ b/sh/update.sh @@ -1,8 +1,8 @@ #!/bin/bash -PUBLIC_DIR="/shared" -GIT_PY_SPIDER="https://git.nps.crabapples.cn/crabapples/learn-spider.git" - +PUBLIC_DIR="${1:-/shared}" +GIT_PY_SPIDER="${2:-https://git.nps.crabapples.cn/crabapples/learn-spider.git}" +echo "开始更新爬虫" cd $PUBLIC_DIR if [ -d "learn-spider" ]; then cd learn-spider