Amazon EC2 Minecraft 服务器 - 不能 运行 mc 命令,只有 运行s bash 命令
Amazon EC2 Minecraft Server - Cannot run mc commands, only runs bash commands
通常情况下,手动使用 SSH 连接到我的 EC2 服务器,然后 运行 执行此命令将启动 Minecraft 服务器并允许我输入 Minecraft 命令
java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui
但是,我在我的计算机上创建了一个批处理文件来自动启动 EC2 服务器(使用 AWSCLI)和 Minecraft 服务器。
aws ec2 start-instances --instance-ids <INSTANCE ID>
ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; bash | java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
第 1 行使用 AWS 的命令行界面启动 EC2 服务器。第 2 行从我的电脑连接到它,将目录更改为 MC 服务器,然后 运行s 它。
但是,一旦服务器启动,我只能在终端中输入 bash 命令——而不是 Minecraft 命令。
有什么方法可以将焦点“更改”到 Minecraft 服务器上吗?
这是我 运行 批处理文件时发生的情况。
G:\Games\MC\My SMP>aws ec2 start-instances --instance-ids <INSTANCE ID>
{
"StartingInstances": [
{
"CurrentState": {
"Code": 16,
"Name": "running"
},
"InstanceId": "<INSTANCE ID>",
"PreviousState": {
"Code": 16,
"Name": "running"
}
}
]
}
G:\Games\MC\My SMP>ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; bash | java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
Starting net.minecraft.server.Main
[16:53:33] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:37] [Worker-Main-2/INFO]: Loaded 7 recipes
[16:53:38] [Worker-Main-2/INFO]: Loaded 1141 advancements
[16:53:40] [Server thread/INFO]: Starting minecraft server version 1.18.2
[16:53:41] [Server thread/INFO]: Loading properties
[16:53:41] [Server thread/INFO]: Default game type: SURVIVAL
[16:53:41] [Server thread/INFO]: Generating keypair
[16:53:41] [Server thread/INFO]: Starting Minecraft server on 0.0.0.0:25565
[16:53:41] [Server thread/INFO]: Using epoll channel type
[16:53:41] [Server thread/INFO]: Preparing level "goldenSMP"
[16:53:47] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:50] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:50] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:51] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:51] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:52] [Worker-Main-2/INFO]: Preparing spawn area: 1%
[16:53:52] [Worker-Main-2/INFO]: Preparing spawn area: 4%
[16:53:53] [Worker-Main-2/INFO]: Preparing spawn area: 4%
[16:53:53] [Worker-Main-2/INFO]: Preparing spawn area: 7%
[16:53:54] [Worker-Main-2/INFO]: Preparing spawn area: 9%
[16:53:54] [Worker-Main-2/INFO]: Preparing spawn area: 13%
[16:53:55] [Worker-Main-2/INFO]: Preparing spawn area: 21%
[16:53:55] [Worker-Main-2/INFO]: Preparing spawn area: 31%
[16:53:56] [Worker-Main-2/INFO]: Preparing spawn area: 50%
[16:53:56] [Worker-Main-2/INFO]: Preparing spawn area: 62%
[16:53:57] [Worker-Main-2/INFO]: Preparing spawn area: 83%
[16:53:58] [Server thread/INFO]: Time elapsed: 10591 ms
[16:53:58] [Server thread/INFO]: Done (16.919s)! For help, type "help"
say hi
bash: line 1: say: command not found
(通常,在 linux 控制台中输入 say hi
会在 Minecraft 聊天中打印 [Server] hi
,如下所示:
(image of what SHOULD happen: server saying hi in the minecraft text chat)
据我了解;
您正在以默认使用 /bin/bash 服务器的 ec2-user 身份登录服务器。 (我假设它是以下之一 - Amazon Linux、RHEL、SUSE、Ubuntu,因为它们默认提供 user-name ec2-user)
所以,你并不真的需要 运行 命令“bash |”在 semi-colon 符号之后。
ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
我相信它应该能为您提供您正在寻找的基于 Java 的 MineCraft 聊天服务器。
通常情况下,手动使用 SSH 连接到我的 EC2 服务器,然后 运行 执行此命令将启动 Minecraft 服务器并允许我输入 Minecraft 命令
java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui
但是,我在我的计算机上创建了一个批处理文件来自动启动 EC2 服务器(使用 AWSCLI)和 Minecraft 服务器。
aws ec2 start-instances --instance-ids <INSTANCE ID>
ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; bash | java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
第 1 行使用 AWS 的命令行界面启动 EC2 服务器。第 2 行从我的电脑连接到它,将目录更改为 MC 服务器,然后 运行s 它。
但是,一旦服务器启动,我只能在终端中输入 bash 命令——而不是 Minecraft 命令。
有什么方法可以将焦点“更改”到 Minecraft 服务器上吗?
这是我 运行 批处理文件时发生的情况。
G:\Games\MC\My SMP>aws ec2 start-instances --instance-ids <INSTANCE ID>
{
"StartingInstances": [
{
"CurrentState": {
"Code": 16,
"Name": "running"
},
"InstanceId": "<INSTANCE ID>",
"PreviousState": {
"Code": 16,
"Name": "running"
}
}
]
}
G:\Games\MC\My SMP>ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; bash | java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
Starting net.minecraft.server.Main
[16:53:33] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, location] and [teleport, targets] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, destination] and [teleport, targets] with inputs: [Player, 0123, @e, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets] and [teleport, destination] with inputs: [Player, 0123, dd12be42-52a9-4a91-a8a1-11c01849e498]
[16:53:36] [ServerMain/WARN]: Ambiguity between arguments [teleport, targets, location] and [teleport, targets, destination] with inputs: [0.1 -0.5 .9, 0 0 0]
[16:53:37] [Worker-Main-2/INFO]: Loaded 7 recipes
[16:53:38] [Worker-Main-2/INFO]: Loaded 1141 advancements
[16:53:40] [Server thread/INFO]: Starting minecraft server version 1.18.2
[16:53:41] [Server thread/INFO]: Loading properties
[16:53:41] [Server thread/INFO]: Default game type: SURVIVAL
[16:53:41] [Server thread/INFO]: Generating keypair
[16:53:41] [Server thread/INFO]: Starting Minecraft server on 0.0.0.0:25565
[16:53:41] [Server thread/INFO]: Using epoll channel type
[16:53:41] [Server thread/INFO]: Preparing level "goldenSMP"
[16:53:47] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:49] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:50] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:50] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:51] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:51] [Worker-Main-2/INFO]: Preparing spawn area: 0%
[16:53:52] [Worker-Main-2/INFO]: Preparing spawn area: 1%
[16:53:52] [Worker-Main-2/INFO]: Preparing spawn area: 4%
[16:53:53] [Worker-Main-2/INFO]: Preparing spawn area: 4%
[16:53:53] [Worker-Main-2/INFO]: Preparing spawn area: 7%
[16:53:54] [Worker-Main-2/INFO]: Preparing spawn area: 9%
[16:53:54] [Worker-Main-2/INFO]: Preparing spawn area: 13%
[16:53:55] [Worker-Main-2/INFO]: Preparing spawn area: 21%
[16:53:55] [Worker-Main-2/INFO]: Preparing spawn area: 31%
[16:53:56] [Worker-Main-2/INFO]: Preparing spawn area: 50%
[16:53:56] [Worker-Main-2/INFO]: Preparing spawn area: 62%
[16:53:57] [Worker-Main-2/INFO]: Preparing spawn area: 83%
[16:53:58] [Server thread/INFO]: Time elapsed: 10591 ms
[16:53:58] [Server thread/INFO]: Done (16.919s)! For help, type "help"
say hi
bash: line 1: say: command not found
(通常,在 linux 控制台中输入 say hi
会在 Minecraft 聊天中打印 [Server] hi
,如下所示:
(image of what SHOULD happen: server saying hi in the minecraft text chat)
据我了解; 您正在以默认使用 /bin/bash 服务器的 ec2-user 身份登录服务器。 (我假设它是以下之一 - Amazon Linux、RHEL、SUSE、Ubuntu,因为它们默认提供 user-name ec2-user)
所以,你并不真的需要 运行 命令“bash |”在 semi-colon 符号之后。
ssh -i "Minecraft SMP.pem" ec2-user@DNS "cd MC/Server ; java -Xmx7G -Xms7G -jar vanilla-1.18.2.jar nogui"
我相信它应该能为您提供您正在寻找的基于 Java 的 MineCraft 聊天服务器。