Skip to content
Advertisement

How do I grab console output from a program running in a screen session?

I’m currently in the process of hacking together a bit of bash and python3 to integrate my Minecraft server with my friends Discord. I managed to power through most of the planned features with nary a hitch, however now I’ve gotten myself stuck halfway into the chat integration. I can send messages from the Discord to the server no problem, but I have no idea how to read the console output of the server instance, which is running in a screen session.

I would appreciate some pointers in the right direction, if you know how this sort of thing is done. Ideally I would like a solution that is capable of running asynchronously, so I don’t have to do a whole lot of busy-waiting to check for messages.

P.S.: Sorry if this belongs on superuser instead, I wasn’t sure where to put it.

Advertisement

Answer

Well, the ideal solution would be to write a bukkit plugin/forge mod to do this, rather than doing this entirely from outside the actual server. That being said, however, your best bet is probably watching the log files, as JNevill says in the comment.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement