Skip to content

Instantly share code, notes, and snippets.

@koliadych
Created May 10, 2026 20:35
Show Gist options
  • Select an option

  • Save koliadych/6a28fba687f0dc94db460f5ee3b2cb08 to your computer and use it in GitHub Desktop.

Select an option

Save koliadych/6a28fba687f0dc94db460f5ee3b2cb08 to your computer and use it in GitHub Desktop.
fintechner dashboard diagnostic
#!/bin/bash
# fintechner — diagnose why the dashboard isn't responding (502).
set -euo pipefail
REGION=ap-northeast-1
INSTANCE_ID=i-089ad4a6b76132ba2
echo "=== Sending diagnostic command to EC2 ==="
CMD_ID=$(aws --region "$REGION" ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name AWS-RunShellScript \
--parameters 'commands=[
"echo === systemd dashboard status ===",
"sudo systemctl status fintechner-dashboard --no-pager -l || true",
"echo",
"echo === recent journal ===",
"sudo journalctl -u fintechner-dashboard -n 80 --no-pager || true",
"echo",
"echo === dashboard filesystem ===",
"ls -la /opt/fintechner/dashboard/ 2>&1 | head -20",
"echo",
"echo === port 3000 listener ===",
"sudo ss -tlnp | grep :3000 || echo no listener on 3000",
"echo",
"echo === env file ===",
"sudo cat /etc/fintechner/dashboard.env"
]' \
--query Command.CommandId --output text)
echo " Command ID: $CMD_ID"
echo "=== Waiting for it to complete ==="
for i in $(seq 1 20); do
sleep 3
STATUS=$(aws --region "$REGION" ssm get-command-invocation \
--command-id "$CMD_ID" --instance-id "$INSTANCE_ID" \
--query Status --output text 2>/dev/null || echo Pending)
case "$STATUS" in
Success|Failed|Cancelled|TimedOut)
echo " $STATUS"
break ;;
*) echo " ($i) $STATUS" ;;
esac
done
echo
echo "============================================================"
echo " STDOUT"
echo "============================================================"
aws --region "$REGION" ssm get-command-invocation \
--command-id "$CMD_ID" --instance-id "$INSTANCE_ID" \
--query StandardOutputContent --output text
echo
echo "============================================================"
echo " STDERR"
echo "============================================================"
aws --region "$REGION" ssm get-command-invocation \
--command-id "$CMD_ID" --instance-id "$INSTANCE_ID" \
--query StandardErrorContent --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment