diff --git a/install.sh b/install.sh index b0c67b0..71ce85d 100755 --- a/install.sh +++ b/install.sh @@ -517,15 +517,32 @@ perform_update_only() { # Gateway starten systemctl --user start hermes-gateway 2>/dev/null || true - # 6. Verify Rocket.Chat connected (wait up to 60s — Gateway braucht länger nach Cleanup) + # 6. Verify BOTH platforms connected (gateway_state.json — robuster als Journal-Grep) msg verifying local verified=false for i in $(seq 1 24); do sleep 2.5 - if journalctl --user -u hermes-gateway --since "60 seconds ago" --no-pager 2>/dev/null \ - | grep -qE "rocketchat.*connected|✓ rocketchat connected|Subscribed to.*[0-9]+ room"; then - verified=true - break + if [ -f "$HOME/.hermes/gateway_state.json" ]; then + local state_check + state_check=$(python3 -c " +import json, sys +try: + with open('$HOME/.hermes/gateway_state.json') as f: + d = json.load(f) + platforms = d.get('platforms', {}) + rc = platforms.get('rocketchat', {}).get('state', '') + tg = platforms.get('telegram', {}).get('state', '') + if rc == 'connected' and tg == 'connected': + print('OK') + else: + print('WAITING: rc={}, tg={}'.format(rc, tg)) +except Exception as e: + print('ERROR: {}'.format(e)) +" 2>/dev/null) + if [ "$state_check" = "OK" ]; then + verified=true + break + fi fi if [ $((i % 4)) -eq 0 ]; then msg verify_timeout