wll595/CTChatGPT
0
1#!/bin/bash2 3# 获取脚本所在目录4script_dir=$(dirname "$(readlink -f "$0")")5 6# 将工作目录更改为脚本所在目录7cd "$script_dir" || exit8 9# 检查Git仓库是否有更新10git remote update11pwd12 13if ! git status -uno | grep 'up to date' > /dev/null; then14 # 如果有更新,关闭当前运行的服务器15 pkill -f ChuanhuChatbot.py16 17 # 拉取最新更改18 git pull19 20 # 安装依赖21 pip3 install -r requirements.txt22 23 # 重新启动服务器24 nohup python3 ChuanhuChatbot.py &25fi26 27# 检查ChuanhuChatbot.py是否在运行28if ! pgrep -f ChuanhuChatbot.py > /dev/null; then29 # 如果没有运行,启动服务器30 nohup python3 ChuanhuChatbot.py &31fi32 