&1`; } elseif ($_POST['action'] == "off") { $out = `aws ec2 stop-instances --region=$REGION --instance-id $INSTANCE_ID`; } elseif ($_POST['action'] == "status") { $status = `aws ec2 describe-instance-status --region=$REGION --include-all-instances --instance-id $INSTANCE_ID 2>&1`; $json = json_decode($status, true); $statusOut = $json['InstanceStatuses'][0]['InstanceState']['Name']; if ($json['InstanceStatuses'][0]['InstanceState']['Name'] == "running") { $players = `python3 /var/minecraft/minestatus.py 2>&1`; $json = json_decode($players, true); if ($json['players'] !== null) { $statusOut .= " with ".$json['players']." players"; } else { $statusOut .= " but not reachable yet."; } } exit($statusOut); } if ($out) { $json = json_decode($out, true); if ($_POST['action'] == "on") { echo "Go back

Result: "; } if ($json['StartingInstances']) { exit($json['StartingInstances'][0]['CurrentState']['Name']); } elseif ($json['StoppingInstances']) { exit($json['StoppingInstances'][0]['CurrentState']['Name']); } elseif ($json['InstanceStatuses']) { exit($json['InstanceStatuses'][0]['InstanceState']['Name']); } } ?> Minecraft Server Control Minecraft-Minder

Press this button to turn on the server. It'll take a couple minutes to fully turn on, and it'll turn off automatically after about 30 minutes of inactivity.


Current status: