#!/bin/bash # Nur lesend: Stand der eingerichteten Dienste der Trading Plattform in WSL-Debian. # Das Journal liest, wer in der Gruppe adm oder systemd-journal ist (hier: claude in adm); # sonst mit sudo -- dann das Passwort ueber WSLENV als WSL_PW durchreichen, nie ausgeben. PROJEKT="/mnt/d/Claude/Code Projekte/active - Trading Plattform" journal() { if journalctl -u "$1" --no-pager -n 1 >/dev/null 2>&1; then journalctl -u "$1" --no-pager -n "$2" -o short-iso | cut -c1-200 elif [ -n "$WSL_PW" ]; then printf '%s\n' "$WSL_PW" | sudo -S -p '' journalctl -u "$1" --no-pager -n "$2" -o short-iso | cut -c1-200 else echo "(Journal nicht lesbar: weder Gruppe adm/systemd-journal noch WSL_PW)" fi } echo "=== $(date -Is) ===" echo "--- dateien ---" ls -la /etc/systemd/system/ | grep -i "trading" | awk '{print $1, $5, $9}' echo "--- enabled ---" for u in trading-dashboard.service trading-paper.timer trading-paper.service; do printf '%s: ' "$u"; systemctl is-enabled "$u" 2>&1 done echo "--- zustand ---" systemctl show -p ActiveState -p SubState -p Result -p ExecMainStartTimestamp -p NRestarts trading-dashboard.service | tr '\n' ' '; echo systemctl show -p ActiveState -p SubState -p Result -p ExecMainStartTimestamp -p ExecMainExitTimestamp -p ExecMainStatus trading-paper.service | tr '\n' ' '; echo echo "--- zeitgeber ---" systemctl list-timers trading-paper.timer --all --no-pager | head -4 echo "--- gesund ---" curl -s -o /dev/null -w 'dashboard in WSL: HTTP %{http_code}\n' --max-time 4 http://127.0.0.1:8144/api/gesund echo "--- systemd laeuft seit ---" systemctl show -p UserspaceTimestamp --value echo "--- journal runner (letzte 16) ---" journal trading-paper.service 16 echo "--- journal dashboard (letzte 8) ---" journal trading-dashboard.service 8 echo "--- status.json und tagesstart.json (ohne Kontowerte) ---" python3 - "$PROJEKT" <<'EOF' import json import sys from pathlib import Path ordner = Path(sys.argv[1]) / "data" / "paper" for name, felder in ( ("status.json", ("zeit", "phase", "killswitch", "position", "letzter_grund", "pid", "boot")), ("tagesstart.json", ("handelstag",)), ): try: daten = json.loads((ordner / name).read_text(encoding="utf-8")) except (OSError, ValueError) as ausnahme: print(f"{name}: nicht lesbar ({type(ausnahme).__name__})") continue print(name, {k: daten.get(k) for k in felder}) EOF