简体   繁体   English

插入命令以运行Java进程Linux

[英]Insert commands to running java process linux

Context: I have a minecraft server running in the background, but I cannot access any of the server commands because it is running in the background... If know the PID of the process, is there any way to give the server commands in the running thread? 上下文:我的Minecraft服务器在后台运行,但是我无法访问任何服务器命令,因为它在后台运行...如果知道进程的PID,是否有任何方法可以在后台提供服务器命令运行线程? Some research suggested named pipes, but I am not sure if that is correct or how to use them in this example. 一些研究建议使用命名管道,但是我不确定这是否正确或在此示例中如何使用它们。

What I am looking to do: Issue commands to currently running minecraft server. 我要做什么:向当前正在运行的Minecraft服务器发出命令。 Something like: ban playerName | 像这样:禁止playerName | 28013 28013

While I don't know anything about minecraft server, if it's accepting commands from stdin, you should be able to use the named pipe concept. 虽然我对Minecraft服务器一无所知,但是如果它正在接受来自stdin的命令,那么您应该能够使用命名管道概念。

mkfifo minecraft_in
whatever_command_to_start_mincraft < minecraft_in > minecraft_out 2>&1 &

Then whenever you want to send anything to the process: 然后,只要您想向流程发送任何内容:

echo "Command" > mincraft_in

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM