#!/bin/bash # flap-check.sh - count browser relaunches per profile in the last hour # Called by the browser-flap-detector cron. Avoids nested SSH quoting hell. cutoff=$(date -u -d "1 hour ago" +%Y-%m-%dT%H:%M:%S) for prof in muse pip 646 opm; do n=$(grep "\[$prof\]" /home/super/Projects/NetVM/chromebox-watchdog.log 2>/dev/null | grep "relaunch OK" | awk -v d="$cutoff" '{ts=substr($1,2,19); if (ts > d) c++} END {print c+0}') echo "$prof:$n" done