43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Python 3.14 + gevent fork 경고 억제
|
|
export GEVENT_NOWAITPID=1
|
|
export PYTHONWARNINGS="ignore::DeprecationWarning"
|
|
|
|
CONFIGFILE="./config.yaml"
|
|
COUNT=0
|
|
|
|
# 🔧 서버 시작 전에 플러그인 업데이트
|
|
update_plugins() {
|
|
PLUGINS_DIR="./data/plugins"
|
|
if [ -d "$PLUGINS_DIR" ]; then
|
|
for dir in "$PLUGINS_DIR"/*/; do
|
|
if [ -d "$dir/.git" ]; then
|
|
echo "Updating plugin: $dir"
|
|
git -C "$dir" reset --hard HEAD 2>/dev/null
|
|
git -C "$dir" pull 2>/dev/null & # 병렬 실행
|
|
fi
|
|
done
|
|
wait # 모든 git pull 완료 대기
|
|
fi
|
|
}
|
|
# 첫 실행 시 또는 --update 옵션일 때만
|
|
if [ "$COUNT" = "0" ]; then
|
|
update_plugins
|
|
fi
|
|
|
|
while true;
|
|
do
|
|
python -m flaskfarm.main --repeat ${COUNT} --config ${CONFIGFILE}
|
|
RESULT=$?
|
|
echo "PYTHON EXIT CODE : ${RESULT}.............."
|
|
if [ "$RESULT" = "1" ]; then
|
|
echo 'REPEAT....'
|
|
update_plugins # 재시작 시에도 업데이트
|
|
else
|
|
echo 'FINISH....'
|
|
break
|
|
fi
|
|
COUNT=`expr $COUNT + 1`
|
|
done
|