From 559b712a06cc0cf221cb7f371ba13068305a8dce Mon Sep 17 00:00:00 2001 From: chiupam Date: Fri, 14 Jan 2022 10:20:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0bot.sh=EF=BC=8C=E4=BD=BFq?= =?UTF-8?q?l=20bot=E5=90=8E=E7=AC=AC=E4=B8=89=E6=96=B9bot=E4=BD=BF?= =?UTF-8?q?=E7=94=A8pm2=E5=90=AF=E5=8A=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/bot.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/shell/bot.sh b/shell/bot.sh index 53076af7..585b4d0f 100644 --- a/shell/bot.sh +++ b/shell/bot.sh @@ -46,7 +46,14 @@ echo -e "\npython3依赖安装成功...\n" echo -e "4、启动bot程序...\n" make_dir $dir_log/bot -cd $dir_root -ps -ef | grep "python3 -m jbot" | grep -v grep | awk '{print $1}' | xargs kill -9 2>/dev/null -nohup python3 -m jbot >$dir_log/bot/nohup.log 2>&1 & +if [[ -z ${BotRepoUrl} ]]; then + cd $dir_root + ps -ef | grep "python3 -m jbot" | grep -v grep | awk '{print $1}' | xargs kill -9 2>/dev/null + nohup python3 -m jbot >$dir_log/bot/nohup.log 2>&1 & +else + cd $dir_root/jbot + pm2 start ecosystem.config.js + cd $dir_root + pm2 restart jbot +fi echo -e "bot启动成功...\n" From 6a691444af6e00f6a0bece1b9dd175511c5785d0 Mon Sep 17 00:00:00 2001 From: Chiupam <65508083+chiupam@users.noreply.github.com> Date: Fri, 14 Jan 2022 17:35:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9docker-entrypoint.sh?= =?UTF-8?q?=E4=BD=BF=E7=94=A8pm2=E5=90=AF=E5=8A=A8bot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index db3b7474..fa3341e3 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -32,7 +32,7 @@ echo -e "定时任务启动成功...\n" if [[ $AutoStartBot == true ]]; then echo -e "======================6. 启动bot========================\n" - nohup ql bot >>$dir_log/start.log 2>&1 & + pm2 start $dir_root/jbot/ecosystem.config.js echo -e "bot后台启动中...\n" fi