Send SSH Commands to Minecraft Console with Screen?

Hi
- in Servers
21

I have another question. In fact:

I'm developing in C # a program with which you can connect to a vServer / root server via SSH, which even works, the only problem is that I want to use the program the Minecraft console.

I can create a screen over the program (daemon), only I can't send commands to this screen.

I've seen that with 'screen -x name -X command' commands can be sent to the screen, but they are not somehow spent in the Minecraft console.

Can someone help me? So in a nutshell, I han made an SSH program in C # with which to use the Minecraft Server console.

Mo

You have to open the screen and then the commands

Co

/ usr / bin / screen -S NAME -p 0 -X stuff "COMMAND $ (printf \\\ r)"

This is how it works with the https://github.com/...CHostPanel

But it is PHP, but maybe useful for you

Hi

Thank you I will try it

Does it mean I can

/ usr / bin / screen -S NAME -p 0 -X stuff "op test"

Hi

Okay, if I enter a command (and by the way at KiTTY in the screen), that is in the command line: say hi $ (printf \ r)

So the "enter" does not work anyway

Co

The partial $ (printf \\\ r) is from PHP to send a Linux line break.

Hi

Okay, so the code to send the command looks like this:

consoleWindow.AppendText (client.RunCommand ("/ usr / bin / screen -S server -p 0 -X stuff '" + consoleCommand.Text + "$ (printf \\\ r)'"). Result + Environment.NewLine + Environment.NewLine);

But the $ (printf \\\ r) is written with pure where you usually enter the commands.

Example:

> say test?
[16:37:08 INFO]: [Server] test?
>
> say hi $ (printf \\\ r)

So the 'Enter' is somehow not accepted to say so

he

You have to first in the screen and then just enter the commands without a /.

Hi

Alright, yes, but I want to use a non-terminal program. With the answer of TopicsLP it works, only the commands are not yet "sent".

The 'Enter' is missing, so to speak

Co

Just try it:

/ usr / bin / screen -S server -p 0 -X stuff "COMMAND \\ r"

Co

I believe something like that? Try it, unfortunately have no direct idea of C # serve me from stackoverflow.com

consoleWindow.AppendText (client.RunCommand ("/ usr / bin / screen -S server -p 0 -X stuff '" + consoleCommand.Text + @ "\\ r"). Result + Environment.NewLine + Environment.NewLine);

Hi

Thanks alot!

It's worked out! I'm very grateful to you!

Since I developed the program, but progressed through your help, I wanted to ask you if I may add you then in the credits, because of your help here because it is one of the important features, so to speak.

edit:

It was that:

consoleWindow.AppendText (client.RunCommand ("/ usr / bin / screen -S server -p 0 -X stuff '" + consoleCommand.Text + "\\ r'"). Result + Environment.NewLine + Environment.NewLine);

Co

Sure, do you need any information from me? Or is my gamertag enough for you? (is on each platform for each game TopicsLP)

Hi

That does not matter I can link you to. For example, Instagram or something similar.

Co
Hi

Okay I will link your Twitter account and a little thank you letter for your help:-)

Co

No problem, nice evening still I'm off

Hi

Thank you likewise

Hi

There's still a question, and this:

So how can I do that now the output of the console is displayed in a TextBoy? So how the principle goes, but I know

consoleWindow.AppendText (client.RunCommand ("/ usr / bin / screen -S server -p 0 -X stuff '" + consoleCommand.Text + "\\ r'"). Result + Environment.NewLine + Environment.NewLine);

Does not show it in the TextBox consoleWindows anymore.

Can I somehow do this with 'screen -O'?

Co

Do I have to look at how this can be solved?

I'll see what I find

Co

For example, would it do the following (linux commands):

screen -S test -L screenlog $ (date '+% d.% m.% Y_% H.% M')

Start a screen named "test" and write everything that happens in the screen to the file "screenlog.DATUM_TIME" instead of the date and time you could use a server id or process id for identification.

and then you can with the command:

tail -n 60 screenlog.23.10.2018_17.35

you spend the last 60 lines

tail -n ROW FILE

I hope this helps.

And you do all this every 15 seconds or so.

Hi

Thanks, I will try it