#!/bin/bash # Python 3.14 + gevent fork κ²½κ³  μ–΅μ œ export GEVENT_NOWAITPID=1 export PYTHONWARNINGS="ignore::DeprecationWarning" CONFIGFILE="/data/config.yaml" COUNT=0 # 🌐 Camoufox λΈŒλΌμš°μ € μΊμ‹œ 경둜 μ„€μ • (마운트된 data 폴더 μ‚¬μš©μœΌλ‘œ 이미지 μš©λŸ‰ 절감) export CAMOUFOX_CACHE_DIR="/data/.camoufox" # πŸ”§ μ„œλ²„ μ‹œμž‘ 전에 ν”ŒλŸ¬κ·ΈμΈ μ—…λ°μ΄νŠΈ 및 λΈŒλΌμš°μ € 확인 update_plugins() { # Camoufox λΈŒλΌμš°μ € 체크 및 λ‹€μš΄λ‘œλ“œ (μ»¨ν…Œμ΄λ„ˆ 졜초 μ‹€ν–‰ μ‹œ 1회) if [ ! -d "$CAMOUFOX_CACHE_DIR" ]; then echo "Fetching Camoufox binaries to $CAMOUFOX_CACHE_DIR..." camoufox fetch fi 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 echo "------------------------------------------------" echo "Starting FlaskFarm Python Process (COUNT: ${COUNT})" echo "Config: ${CONFIGFILE}" echo "------------------------------------------------" python main.py --repeat ${COUNT} --config ${CONFIGFILE} RESULT=$? echo "------------------------------------------------" echo "PYTHON EXIT CODE : ${RESULT}" echo "------------------------------------------------" if [ "$RESULT" = "1" ]; then echo 'Restarting... (RESULT=1)' update_plugins else echo "Exiting... (RESULT=${RESULT})" break fi COUNT=`expr $COUNT + 1` done