update start.sh

This commit is contained in:
mshe 2026-05-28 15:51:08 +08:00
parent ba51bd9efd
commit fec751e060
5 changed files with 12 additions and 10 deletions

View File

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
#wget -O- https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/auto_install.sh | bash #wget -O- https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/bin/auto_install.sh | bash
echo "清理旧脚本..." echo "清理旧脚本..."
rm -rf ./install.sh ./start.sh ./update.sh ./uninstall.sh rm -rf ./install.sh ./start.sh ./update.sh ./uninstall.sh
echo "开始下载..." echo "开始下载..."
echo "下载安装脚本..." echo "下载安装脚本..."
wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/install.sh && chmod +x install.sh wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/bin/install.sh && chmod +x install.sh
echo "下载启动脚本..." echo "下载启动脚本..."
wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/start.sh && chmod +x start.sh wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/bin/start.sh && chmod +x start.sh
echo "下载更新脚本..." echo "下载更新脚本..."
wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/update.sh && chmod +x update.sh wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/bin/update.sh && chmod +x update.sh
echo "下载卸载脚本..." echo "下载卸载脚本..."
wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/sh/uninstall.sh && chmod +x uninstall.sh wget -q --show-progress https://git.nps.crabapples.cn/crabapples/learn-spider/raw/branch/main/bin/uninstall.sh && chmod +x uninstall.sh
echo "下载完成" echo "下载完成"
echo "开始安装..." echo "开始安装..."

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
INDEX=$1 INDEX=$1
spider=$2 spider_code=$2
PUBLIC_DIR="${3:-/shared}" PUBLIC_DIR="${3:-/shared}"
username="user$INDEX" username="user$INDEX"
export DISPLAY=:$INDEX export DISPLAY=:$INDEX
@ -15,11 +15,13 @@ sleep 3
start_spider(){ start_spider(){
cd $PUBLIC_DIR/learn-spider cd $PUBLIC_DIR/learn-spider
sudo -E ./start_spider.sh $spider # -E 保留当前环境变量 echo "$PUBLIC_DIR/learn-spider"
echo "正在启动爬虫$spider_code"
sudo -E ./start_spider.sh $spider_code # -E 保留当前环境变量
} }
echo "启动爬虫" echo "启动爬虫"
start_spider $INDEX start_spider
echo "爬虫执行完毕,60秒后关闭VNC" echo "爬虫执行完毕,20秒后关闭VNC"
sleep 60 sleep 20
sudo su - "$username" -c "vncserver -kill :$INDEX" 2>/dev/null sudo su - "$username" -c "vncserver -kill :$INDEX" 2>/dev/null