Files
youtube-dl/gommi.sh
2025-12-26 22:22:08 +09:00

39 lines
986 B
Bash
Executable File

#!/bin/bash
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