Files
boc/projects/landvex/20-automation/grunduppbyggnad.sh
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

69 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Landvex Grunduppbyggnad — 2 timmar med hög takt
# Kör 10 parallella processer i 2 timmar
set -euo pipefail
cd /home/bernt/.openclaw/workspace/projects/landvex/20-automation
LOG_FILE="/var/log/landvex/grunduppbyggnad-$(date +%Y%m%d-%H%M).log"
mkdir -p /var/log/landvex
echo "=== LANDVEX GRUNDUPPBYGGNAD STARTAR $(date -u +"%Y-%m-%d %H:%M:%S UTC") ===" | tee -a "$LOG_FILE"
echo "Mål: ~2000 artiklar på 2 timmar" | tee -a "$LOG_FILE"
echo "Konfiguration: 10 parallella agenter" | tee -a "$LOG_FILE"
echo "" | tee -a "$LOG_FILE"
START_TIME=$(date +%s)
END_TIME=$((START_TIME + 7200)) # 2 timmar
BATCH_NUM=0
TOTAL_ARTICLES=0
SUCCESS_COUNT=0
FAIL_COUNT=0
while [ $(date +%s) -lt $END_TIME ]; do
BATCH_NUM=$((BATCH_NUM + 1))
echo "Runda $BATCH_NUM startar..." | tee -a "$LOG_FILE"
# Kör 10 parallella batcher med felhantering
PIDS=""
for i in $(seq 1 10); do
AGENT_ID="grund-$(printf "%04d" $BATCH_NUM)-$(printf "%02d" $i)"
# Kör agenten och fånga exit-kod
if python3 kor_agent_kimi.py --agent-id "$AGENT_ID" --cap 10 >> "$LOG_FILE" 2>&1; then
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
TOTAL_ARTICLES=$((TOTAL_ARTICLES + 10))
else
FAIL_COUNT=$((FAIL_COUNT + 1))
echo "$AGENT_ID misslyckades" | tee -a "$LOG_FILE"
fi &
PIDS="$PIDS $!"
done
# Vänta på alla att bli klara
for pid in $PIDS; do
if ! wait $pid; then
echo " Varning: Process $pid avslutades med fel" | tee -a "$LOG_FILE"
fi
done
ELAPSED=$(($(date +%s) - START_TIME))
RATE=$((TOTAL_ARTICLES * 3600 / ELAPSED))
echo "Runda $BATCH_NUM klar. Totalt: $TOTAL_ARTICLES artiklar. Takt: $RATE art/h. Succes: $SUCCESS_COUNT. Fel: $FAIL_COUNT" | tee -a "$LOG_FILE"
# Kontrollera om vi nått 2 timmar
if [ $(date +%s) -ge $END_TIME ]; then
break
fi
done
echo "" | tee -a "$LOG_FILE"
echo "=== GRUNDUPPBYGGNAD AVSLUTAD $(date -u +"%Y-%m-%d %H:%M:%S UTC") ===" | tee -a "$LOG_FILE"
echo "Totalt producerade: $TOTAL_ARTICLES artiklar" | tee -a "$LOG_FILE"
echo "Lyckade körningar: $SUCCESS_COUNT" | tee -a "$LOG_FILE"
echo "Misslyckade: $FAIL_COUNT" | tee -a "$LOG_FILE"
echo "Loggfil: $LOG_FILE" | tee -a "$LOG_FILE"