light & magic

This commit is contained in:
2025-12-12 21:40:49 +01:00
parent ada697c7d0
commit 688ff3d4d7

View File

@@ -241,14 +241,39 @@ function watchdog() {
CMD="\$1"
case "\$CMD" in
status)
PID_RUNNING=false
if [ -f "\$WATCHDOG_PID" ] && kill -0 \$(cat "\$WATCHDOG_PID") 2>/dev/null; then
PID_RUNNING=true
PID=\$(cat "\$WATCHDOG_PID")
elif pgrep -f "ssh-agent-guard.sh" > /dev/null; then
PID_RUNNING=true
PID=\$(pgrep -f "ssh-agent-guard.sh" | head -n 1)
# Fix PID file if missing but running
echo "\$PID" > "\$WATCHDOG_PID"
elif pgrep -f "ssh-agent-screenlock" > /dev/null; then
PID_RUNNING=true
PID=\$(pgrep -f "ssh-agent-screenlock" | head -n 1)
fi
if [ "\$PID_RUNNING" = true ]; then
if [ -f "\$WATCHDOG_PAUSE" ]; then
echo "⚠️ Watchdog läuft (PID \$(cat \$WATCHDOG_PID)), ist aber PAUSIERT (Deep Work)."
echo "⚠️ Watchdog läuft (PID \$PID), ist aber PAUSIERT (Deep Work)."
else
echo "✅ Watchdog läuft und ist scharf (PID \$(cat \$WATCHDOG_PID))."
echo "✅ Watchdog läuft und ist scharf (PID \$PID)."
fi
else
echo "❌ Watchdog läuft nicht."
echo "❌ Watchdog Script läuft nicht."
fi
# Check Agent Socket
SOCKET="\$HOME/.ssh/agent.sock"
if [ -S "\$SOCKET" ]; then
echo "✅ SSH Agent Socket gefunden (\$SOCKET)."
# Optional: Count keys
KEY_COUNT=\$(SSH_AUTH_SOCK=\$SOCKET ssh-add -l 2>/dev/null | wc -l | tr -d ' ')
echo " -> Geladene Keys: \$KEY_COUNT"
else
echo "❌ Kein SSH Agent Socket gefunden."
fi
;;
off|pause)