From c42651e57a5ba0806d701ea37228ec64f553ed57 Mon Sep 17 00:00:00 2001 From: fanyufeng Date: Thu, 6 Apr 2023 10:38:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=B9=B6=E5=B0=86?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E8=87=B3=20logs/log=5Finfo?= =?UTF-8?q?.log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/shutdown.sh | 19 +++++++++++++++++++ scripts/start.sh | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 scripts/shutdown.sh create mode 100755 scripts/start.sh diff --git a/scripts/shutdown.sh b/scripts/shutdown.sh new file mode 100755 index 0000000..6afde41 --- /dev/null +++ b/scripts/shutdown.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +#关闭服务 +cd `dirname $0`/.. +export BASE_DIR=`pwd` +pid=`ps ax | grep -i app.py | grep "${BASE_DIR}" | grep python3 | grep -v grep | awk '{print $1}'` +if [ -z "$pid" ] ; then + echo "No bot-on-anaything running." + exit -1; +fi + +echo "The bot-on-anaything(${pid}) is running..." + +kill ${pid} + +echo "Send shutdown request to bot-on-anaything(${pid}) OK" + + + diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100755 index 0000000..610a95a --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,18 @@ +#!/bin/bash +#后台运行bot-on-anaything执行脚本 + +cd `dirname $0`/.. +export BASE_DIR=`pwd` +echo $BASE_DIR + +# check the nohup.out log output file +if [ ! -f "${BASE_DIR}/logs/log_info.log" ]; then + mkdir "${BASE_DIR}/logs" + touch "${BASE_DIR}/logs/log_info.log" +echo "${BASE_DIR}/logs/log_info.log" +fi + +nohup python3 "${BASE_DIR}/app.py" >> ${BASE_DIR}/logs/log_info.log & tail -f "${BASE_DIR}/logs/log_info.log" + +echo "bot-on-anaything is starting,you can check the ${BASE_DIR}/logs/log_info.log" +