Skripte nach bin/ und lib/ umstrukturiert + WSL-Log-Analyse Alle .bat-Skripte liegen jetzt in bin/, alle .py in lib/, .env(.example) in bin/. setenv.bat setzt IWZ_* (inkl. IWZ_ENV) und PYTHONPATH; die Launcher rufen setenv, aktivieren die .venv falls vorhanden und starten das zugehoerige lib/-Skript. Die Python-Skripte lesen die .env ueber IWZ_ENV (Fallback bin/.env). Neu: Nutzungsanalyse per GoAccess (analyze.py/.bat) - laedt die IONOS-Access-Logs per SFTP (paramiko) und erzeugt einen HTML-Report. GoAccess laeuft ueber WSL (GOACCESS_MODE=wsl, Pfad-Uebersetzung nach /mnt/c). install_py.bat prueft WSL+GoAccess und zeigt sonst den Installationsweg. Doku in doc/analyse.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> @
55 lines
1.9 KiB
Batchfile
55 lines
1.9 KiB
Batchfile
@echo off
|
|
REM ================================================================
|
|
REM IWZ - Python Virtual Environment einrichten
|
|
REM ================================================================
|
|
|
|
call "%~dp0setenv.bat"
|
|
|
|
if not exist "%IWZ%\.venv" (
|
|
echo Initialisiere Python virtual environment...
|
|
py -m venv "%IWZ%\.venv" --upgrade-deps
|
|
echo Erfolgreich.
|
|
|
|
call "%IWZ%\.venv\Scripts\activate.bat"
|
|
echo Installiere erforderliche Python Packages...
|
|
pip install -r "%IWZ%\requirements.txt" -q
|
|
echo Erfolgreich.
|
|
deactivate
|
|
) else (
|
|
echo Erforderliche Python Packages bereits installiert!
|
|
)
|
|
|
|
echo.
|
|
echo ================================================================
|
|
echo Pruefe Nutzungsanalyse-Voraussetzungen (WSL + GoAccess)
|
|
echo ================================================================
|
|
|
|
REM 1) Ist WSL verfuegbar?
|
|
where wsl >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo [FEHLT] WSL ist nicht installiert.
|
|
echo So einrichten ^(einmalig, PowerShell als Administrator^):
|
|
echo wsl --install
|
|
echo Danach Windows neu starten und die Ubuntu-Ersteinrichtung
|
|
echo ^(Benutzername/Passwort^) durchlaufen. Anschliessend GoAccess
|
|
echo wie unten installieren.
|
|
goto :wsl_done
|
|
)
|
|
echo [OK] WSL gefunden.
|
|
|
|
REM 2) Ist GoAccess in der WSL installiert?
|
|
wsl -e bash -lc "command -v goaccess >/dev/null 2>&1"
|
|
if errorlevel 1 (
|
|
echo [FEHLT] GoAccess ist in der WSL nicht installiert.
|
|
echo So installieren:
|
|
echo wsl -e sudo apt update
|
|
echo wsl -e sudo apt install -y goaccess
|
|
echo ^(fragt einmalig nach dem WSL-sudo-Passwort^)
|
|
) else (
|
|
for /f "delims=" %%V in ('wsl -e bash -lc "goaccess --version ^| head -1"') do set "GA_VER=%%V"
|
|
echo [OK] GoAccess in der WSL: %GA_VER%
|
|
)
|
|
|
|
:wsl_done
|
|
echo ================================================================
|