You are not logged in.

#1 2012-12-18 23:18:22

computerquip
Member
Registered: 2009-08-11
Posts: 19

Interactive-Only Server Interface

Minecraft has probably the worst server software I've seen. It has no daemon mode and it requires interaction. I'd like to avoid a complex bash script (although I can easily see how it could be useful here) and I would like to just use systemd for startup and shutdown during system events. I've tried various things but each time, it ends in the server spamming ">" in my log to the point it causes itself to not respond. I'd also like to completely avoid the use of screen if possible. Anyone have ideas?

Last edited by computerquip (2012-12-18 23:20:08)

Offline

#2 2012-12-19 10:59:52

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: Interactive-Only Server Interface

I do not play Minecraft, because I refuse to install Oracle Java, so I don't know for sure what problems you are having.

However, I bet “Expect” will solve your problem. It is a very simple scripting language that reads Standard Out and sends keystrokes back to Standard In. In other words, it allows you to program around User Interactive prompts.

Like here is a complex enough example.
I use this to help me make OpenVPN Keys with EasyRSA

create-user-keys.exp

#!/usr/bin/expect

set user [lindex $argv 0]
set pass [lindex $argv 1]

spawn /root/easy-rsa/build-key-pass $user

expect "Enter PEM pass phrase:"

send "$pass\n"

expect "Verifying - Enter PEM pass phrase:"

send "$pass\n"

interact

Like if you call this scrip from Bash script... you would do this...

create-user-keys.exp bob pass123

$argv 0 will be "bob"
$argv 1 will be "pass123"

Then it will run the script /root/easy-rsa/build-key-pass
Waite until the build-keypass script sends that text in the “expect” lines to Standard out, and sends to the program then stuff in the “send” lines. … note the new line character \n

Last edited by hunterthomson (2012-12-19 11:02:25)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#3 2012-12-26 17:48:23

unifiedlinux
Member
Registered: 2012-11-03
Posts: 20

Re: Interactive-Only Server Interface

Hello,

I think this will work fine for you -> https://aur.archlinux.org/packages/mine … r-systemd/, it uses screen but i don't think there's any easy way to not use it (if you're an experienced Java programmer, you could decompile the server.jar and change it so that it reads settings from a file and runs as a "daemon")...

PS: for me, Minecraft runs fine with Openjdk, so you can play it without Oracle's JVM.

Have a nice day.

Offline

Board footer

Powered by FluxBB