Skip to content

Update watchdog.sh to wait STARTUPMIN for port listen#80

Open
4rt3m1sF0wl wants to merge 1 commit intodoctorray117:mainfrom
4rt3m1sF0wl:patch-1
Open

Update watchdog.sh to wait STARTUPMIN for port listen#80
4rt3m1sF0wl wants to merge 1 commit intodoctorray117:mainfrom
4rt3m1sF0wl:patch-1

Conversation

@4rt3m1sF0wl
Copy link
Copy Markdown

Adjust MC version checker to wait for $STARTUPMIN minutes, as if server does not listen until started, it will always be terminated before listening on its respective port, making the STARTUPMIN env variable nonfunctional.

Adjust MC version checker to wait for $STARTUPMIN minutes, as if server does not listen until started, it will always be terminated before listening on its respective port, making the STARTUPMIN env variable nonfunctional.
@4rt3m1sF0wl
Copy link
Copy Markdown
Author

Looked through open issues and didn't see anything applicable. Currently experiencing bug that I believe is related to this while attempting to run Stoneblock 4 with Neoforge (1.21.1). I guess rather than opening the port for listening on startup, it leaves it closed until fully prepared to handle incoming connections.

While starting up, rather than the usual warning on attempted connection:

Server is still starting!

It simply throws an error:

finishConnect(..) failed: Connection refused

It does this until opening. Occasionally it beats the built-in 10 minute timer and allows connection, working appropriately afterwards, but usually is automatically shutdown.

I've censored some information in the logs, but this configuration is otherwise functional, also have a task definition configured for use with GTNH on Forge (1.7.10) which detects version and respects STARTUPMIN changes flawlessly. I assume this is due to differences in modloader or MC version which changes startup behavior.

See current JSON configuration for the watchdog:

"name": "minecraft-ecsfargate-watchdog",
  "image": "doctorray/minecraft-ecsfargate-watchdog",
  "cpu": 0,
  "portMappings": [],
  "essential": true,
  "environment": [
    {
      "name": "TWILIOAUTH",
      "value": ""
    },
    {
      "name": "TWILIOFROM",
      "value": ""
    },
    {
      "name": "SHUTDOWNMIN",
      "value": "10"
    },
    {
      "name": "TWILIOTO",
      "value": ""
    },
    {
      "name": "DNSZONE",
      "value": "dummyzoneid"
    },
    {
      "name": "SNSTOPIC",
      "value": "mysnstopicid"
    },
    {
      "name": "SERVICE",
      "value": "minecraft-server"
    },
    {
      "name": "TWILIOAID",
      "value": ""
    },
    {
      "name": "CLUSTER",
      "value": "minecraft"
    },
    {
      "name": "STARTUPMIN",
      "value": "15"
    },
    {
      "name": "SERVERNAME",
      "value": "example.com"
    }
  ],
  "mountPoints": [],
  "volumesFrom": [],
  "logConfiguration": {
    "logDriver": "awslogs",
    "options": {
      "awslogs-group": "/ecs/STONEBLOCK4_FORKminecraftserverstackTaskDefinitiondummyid",
      "awslogs-create-group": "true",
      "awslogs-region": "us-east-1",
      "awslogs-stream-prefix": "ecs"
    },
    "secretOptions": []
  },
  "systemControls": []
}

See also startup logs from fargate watchdog for this service:

2026-03-20T12:27:20.401Z
	
I believe our task id is ecstaskid
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:20.992Z
	
I believe our eni is eni-eniid
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:21.774Z
	
I believe our public IP address is 127.0.0.1
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:21.774Z
	
Updating DNS record for example.com to 127.0.0.1
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
{
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
"ChangeInfo": {
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
"Id": "/change/whoknowswhatidthisisinreferencetoid",
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
"Status": "PENDING",
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
"SubmittedAt": "2026-03-20T12:27:22.492000+00:00",
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
"Comment": "Fargate Public IP change for Minecraft Server"
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
}
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.504Z
	
}
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.647Z
	
Determining Minecraft edition based on listening port...
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:27:22.647Z
	
If we are stuck here, the minecraft container probably failed to start. Waiting 10 minutes just in case...
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.061Z
	
10 minutes elapsed without a minecraft server listening, terminating.
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.061Z
	
SNS topic set, sending shutdown message
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.456Z
	
{
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.456Z
	
"MessageId": "snsmessageid"
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.456Z
	
}
	
ecs/minecraft-ecsfargate-watchdog/ecstaskid
	
2026-03-20T12:37:26.499Z

@4rt3m1sF0wl 4rt3m1sF0wl changed the title Update watchdog.sh Update watchdog.sh to wait STARTUPMIN for port listen Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant