#!/usr/bin/env bash # # check_chrome_alive.sh — Health monitor for the headless Chrome process. # # Intended to be run via cron to ensure the headless Chrome process is alive, # listening on port 9223, and not consuming excessive memory. # CDP_PORT=9223 LOG_FILE="/var/log/notebooklm-chrome.log" echo "$(date) [CHROME HEALTH] Starting health check..." >> "$LOG_FILE" # 1. Check if process is running and responding on port 9223 if curl -s "http://127.0.0.1:$CDP_PORT/json/version" > /dev/null; then echo "$(date) [CHROME HEALTH] Chrome CDP is responding on port $CDP_PORT. Status: OK" >> "$LOG_FILE" exit 0 else echo "$(date) [CHROME HEALTH] Chrome CDP not responding! Relaunching..." >> "$LOG_FILE" /opt/ai-os/products/ceo/scripts/revive_notebooklm_auth.sh >> "$LOG_FILE" 2>&1 exit $? fi