mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 07:16:08 +08:00
更新bot启动脚本
This commit is contained in:
parent
af8d52744e
commit
25369e1aa8
21
shell/bot.sh
21
shell/bot.sh
|
@ -4,29 +4,36 @@
|
||||||
dir_shell=/ql/shell
|
dir_shell=/ql/shell
|
||||||
. $dir_shell/share.sh
|
. $dir_shell/share.sh
|
||||||
repo_path="${dir_repo}/SuMaiKaDe_jddockerbot"
|
repo_path="${dir_repo}/SuMaiKaDe_jddockerbot"
|
||||||
|
url="https://ghproxy.com/https://github.com/SuMaiKaDe/jddockerbot.git"
|
||||||
|
|
||||||
echo -e "1、安装bot依赖...\n"
|
echo -e "\n1、安装bot依赖...\n"
|
||||||
apk --no-cache add -f zlib-dev gcc jpeg-dev python3-dev musl-dev freetype-dev
|
apk --no-cache add -f zlib-dev gcc jpeg-dev python3-dev musl-dev freetype-dev
|
||||||
echo
|
echo -e "\nbot依赖安装成功...\n"
|
||||||
|
|
||||||
echo -e "2、下载bot所需文件...\n"
|
echo -e "2、下载bot所需文件...\n"
|
||||||
git clone -b master https://ghproxy.com/https://github.com/SuMaiKaDe/jddockerbot.git $repo_path
|
if [ -d ${repo_path}/.git ]; then
|
||||||
|
reset_romote_url ${repo_path} ${url}
|
||||||
|
git_pull_scripts ${repo_path}
|
||||||
|
else
|
||||||
|
git_clone_scripts ${url} ${repo_path} "master"
|
||||||
|
fi
|
||||||
|
|
||||||
cp -rf "$repo_path/jbot" $dir_root
|
cp -rf "$repo_path/jbot" $dir_root
|
||||||
if [[ ! -f "$dir_root/config/bot.json" ]]; then
|
if [[ ! -f "$dir_root/config/bot.json" ]]; then
|
||||||
cp -f "$repo_path/config/bot.json" "$dir_root/config"
|
cp -f "$repo_path/config/bot.json" "$dir_root/config"
|
||||||
fi
|
fi
|
||||||
echo
|
echo -e "\nbot文件下载成功...\n"
|
||||||
|
|
||||||
echo -e "3、安装python3依赖...\n"
|
echo -e "3、安装python3依赖...\n"
|
||||||
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
cp -f "$repo_path/jbot/requirements.txt" "$dir_root"
|
cp -f "$repo_path/jbot/requirements.txt" "$dir_root"
|
||||||
pip3 --default-timeout=100 install -r requirements.txt --no-cache-dir
|
pip3 --default-timeout=100 install -r requirements.txt --no-cache-dir
|
||||||
echo
|
echo -e "\npython3依赖安装成功...\n"
|
||||||
|
|
||||||
echo -e "4、启动bot程序...\n"
|
echo -e "4、启动bot程序...\n"
|
||||||
cd $dir_root
|
cd $dir_root
|
||||||
ps -ef | grep "python3 -m jbot" | grep -v grep | awk '{print $1}' | xargs kill -9 2>/dev/null
|
ps -ef | grep "python3 -m jbot" | grep -v grep | awk '{print $1}' | xargs kill -9 2>/dev/null
|
||||||
nohup python3 -m jbot & >/dev/null 2>&1
|
nohup python3 -m jbot >$dir_log/bot/nohup.log 2>&1 &
|
||||||
echo
|
echo -e "bot启动成功...\n"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -252,6 +252,30 @@ update_depend() {
|
||||||
cd $dir_current
|
cd $dir_current
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## 克隆脚本,$1:仓库地址,$2:仓库保存路径,$3:分支(可省略)
|
||||||
|
git_clone_scripts() {
|
||||||
|
local url=$1
|
||||||
|
local dir=$2
|
||||||
|
local branch=$3
|
||||||
|
[[ $branch ]] && local cmd="-b $branch "
|
||||||
|
echo -e "开始克隆仓库 $url 到 $dir\n"
|
||||||
|
git clone $cmd $url $dir
|
||||||
|
exit_status=$?
|
||||||
|
}
|
||||||
|
|
||||||
|
## 更新脚本,$1:仓库保存路径
|
||||||
|
git_pull_scripts() {
|
||||||
|
local dir_current=$(pwd)
|
||||||
|
local dir_work=$1
|
||||||
|
cd $dir_work
|
||||||
|
echo -e "开始更新仓库:$dir_work\n"
|
||||||
|
git fetch --all
|
||||||
|
exit_status=$?
|
||||||
|
git reset --hard
|
||||||
|
git pull
|
||||||
|
cd $dir_current
|
||||||
|
}
|
||||||
|
|
||||||
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
|
## 导入配置文件,检测平台,创建软连接,识别命令,修复配置文件
|
||||||
detect_termux
|
detect_termux
|
||||||
detect_macos
|
detect_macos
|
||||||
|
|
|
@ -23,30 +23,6 @@ reset_romote_url() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
## 克隆脚本,$1:仓库地址,$2:仓库保存路径,$3:分支(可省略)
|
|
||||||
git_clone_scripts() {
|
|
||||||
local url=$1
|
|
||||||
local dir=$2
|
|
||||||
local branch=$3
|
|
||||||
[[ $branch ]] && local cmd="-b $branch "
|
|
||||||
echo -e "开始克隆仓库 $url 到 $dir\n"
|
|
||||||
git clone $cmd $url $dir
|
|
||||||
exit_status=$?
|
|
||||||
}
|
|
||||||
|
|
||||||
## 更新脚本,$1:仓库保存路径
|
|
||||||
git_pull_scripts() {
|
|
||||||
local dir_current=$(pwd)
|
|
||||||
local dir_work=$1
|
|
||||||
cd $dir_work
|
|
||||||
echo -e "开始更新仓库:$dir_work\n"
|
|
||||||
git fetch --all
|
|
||||||
exit_status=$?
|
|
||||||
git reset --hard
|
|
||||||
git pull
|
|
||||||
cd $dir_current
|
|
||||||
}
|
|
||||||
|
|
||||||
## 检测cron的差异,$1:脚本清单文件路径,$2:cron任务清单文件路径,$3:增加任务清单文件路径,$4:删除任务清单文件路径
|
## 检测cron的差异,$1:脚本清单文件路径,$2:cron任务清单文件路径,$3:增加任务清单文件路径,$4:删除任务清单文件路径
|
||||||
diff_cron() {
|
diff_cron() {
|
||||||
local list_scripts="$1"
|
local list_scripts="$1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user