Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save koliadych/fb5539e843bd8fd54981d8d95d37a41e to your computer and use it in GitHub Desktop.
fintechner final node fix
#!/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 --- comprehensive node search ---",
"find /usr -name node-20 2>/dev/null",
"find /usr -name \"node*\" -type f -executable 2>/dev/null | head -10",
"sudo dnf reinstall -y nodejs20 2>&1 | tail -5",
"echo --- after reinstall ---",
"find /usr -name node-20 2>/dev/null",
"ls -l /usr/bin/node-20 /usr/bin/node 2>&1",
"echo --- create symlink ---",
"if [ -f /usr/bin/node-20 ]; then sudo ln -sf /usr/bin/node-20 /usr/bin/node; fi",
"ls -l /usr/bin/node",
"/usr/bin/node --version",
"echo --- restart + test ---",
"sudo systemctl reset-failed fintechner-dashboard",
"sudo systemctl restart fintechner-dashboard",
"sleep 8",
"sudo systemctl is-active fintechner-dashboard",
"sudo ss -tlnp | grep :3000 || echo NO-LISTENER",
"curl -sS -o /dev/null -w \"http=%{http_code}\\n\" http://localhost:3000/ || echo curl-failed"
]' \
--query Command.CommandId --output text)
for i in $(seq 1 30); 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
echo "=== STDOUT ==="
aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardOutputContent --output text
echo
echo "=== STDERR ==="
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