#!/bin/bash # Quick script to check client version status echo "=== Client Version Diagnostic ===" echo "" # 1. Check what version is in the file echo "1. Version in client.py file:" if sudo grep -q 'CLIENT_VERSION_BUILD_TIMESTAMP = "' /opt/oculog/client.py 2>/dev/null; then VERSION=$(sudo grep 'CLIENT_VERSION_BUILD_TIMESTAMP = "' /opt/oculog/client.py | head -1 | sed 's/.*"\(.*\)".*/\1/') echo " ✓ Injected version: $VERSION" else echo " ⚠ No injected version found (using file modification time)" MTIME=$(sudo stat -c %y /opt/oculog/client.py 2>/dev/null | cut -d' ' -f1,2 | sed 's/ /T/' | cut -d'.' -f1 | sed 's/T/-/' | sed 's/:/-/g' | cut -d'-' -f1-5) echo " File modification time: $MTIME" fi echo "" # 2. Check what version the client is reporting echo "2. Version reported by running client:" VERSION_IN_LOG=$(sudo journalctl -u oculog-client.service -n 100 2>/dev/null | grep -i "version:" | tail -1 | sed 's/.*version: \([^,]*\).*/\1/') if [ -n "$VERSION_IN_LOG" ]; then echo " ✓ Client reports: $VERSION_IN_LOG" else echo " ⚠ No version found in recent logs" fi echo "" # 3. Check recent metrics sends echo "3. Recent metrics activity:" RECENT_SENDS=$(sudo journalctl -u oculog-client.service -n 20 2>/dev/null | grep -i "metrics sent successfully" | wc -l) if [ "$RECENT_SENDS" -gt 0 ]; then echo " ✓ Metrics are being sent successfully" echo " Last successful send:" sudo journalctl -u oculog-client.service -n 20 2>/dev/null | grep -i "metrics sent successfully" | tail -1 else echo " ⚠ No successful metric sends in recent logs" fi echo "" echo "=== Diagnostic Complete ===" echo "" echo "If version injection failed, the client will use file modification time." echo "To force re-injection, run the update script again."