Created
May 10, 2026 21:57
-
-
Save koliadych/dbecf127b65ec78357ef66640e0ce0f3 to your computer and use it in GitHub Desktop.
fintechner recover diag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| export AWS_PAGER="" | |
| REGION=ap-northeast-1 | |
| INSTANCE_ID=i-089ad4a6b76132ba2 | |
| CMD_ID=$(aws --region "$REGION" ssm send-command \ | |
| --instance-ids "$INSTANCE_ID" \ | |
| --document-name AWS-RunShellScript \ | |
| --parameters '{"commands":[ | |
| "echo === connector status ===", | |
| "sudo systemctl is-active fintechner-connector", | |
| "echo === connector env file (passwords redacted) ===", | |
| "sudo cat /etc/fintechner/connector.env | sed -E \"s/(PASSWORD|KEY|password)=.*/\\1=***/\"", | |
| "echo === last 40 connector log lines ===", | |
| "sudo journalctl -u fintechner-connector -n 40 --no-pager", | |
| "echo === port 8080 ===", | |
| "sudo ss -tlnp | grep :8080 || echo NO-LISTENER" | |
| ]}' \ | |
| --query Command.CommandId --output text) | |
| for i in $(seq 1 20); do | |
| sleep 4 | |
| 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 " $STATUS";; esac | |
| done | |
| echo | |
| aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardOutputContent --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment