Unusual Question - Possible to access BAT file through server prompt

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Týr

New Member
Jul 29, 2019
4
0
0
I run a (semi) private server on my laptop for friends and such, and I was wondering if it was possible to have an op run a restart line through the text chat in-game [Server prompt] that would allow minecraft to access a BAT file that would save the server, stop it; and then start it back up again?

Note: It doesn't have to be a BAT file, but I figured that would be the easiest method.

Input?
PS: I realize this might(?) be the wrong area to post this in, however, it seems to be the most fitting.
 

zergdog

New Member
Jul 29, 2019
15
0
0
You could make it even easier and have the sever auto restart itself, if it were shutdown. The shutdown command is already programmed into the game.
 

glasspelican

New Member
Jul 29, 2019
187
0
0
Yes*

Minecraft can't run a script directly
It should be possible to have a script or other program read the standard out of the server and look for
Something like !restart check against the ops file
Connect to server standard in and issue /save-all and /stop
Wait for server to stop probly by watching file locks then run backup and start server

I have been trying to do something like this on Linux without much success, and little spare time to experiment
 

Týr

New Member
Jul 29, 2019
4
0
0
Yes*

Minecraft can't run a script directly
It should be possible to have a script or other program read the standard out of the server and look for
Something like !restart check against the ops file
Connect to server standard in and issue /save-all and /stop
Wait for server to stop probly by watching file locks then run backup and start server

I have been trying to do something like this on Linux without much success, and little spare time to experiment

Hmm, I wonder how to go about it though, as I don't consider myself that knowledgeable in the area.
Having a script/program read the server log for a certain input would work but I'm not sure if the log is updated real time or simply when the server shuts down.
 

Týr

New Member
Jul 29, 2019
4
0
0
You could make it even easier and have the sever auto restart itself, if it were shutdown. The shutdown command is already programmed into the game.
That would be much easier... Though now, I ask how to do it rather than 'is it possible'.
 

glasspelican

New Member
Jul 29, 2019
187
0
0
My current setup does what zergdog recomended, it works the only problem it that it makes it a pain to shutdown the server for real as the script just keeps restarting it.

I did mine in linux so you cant use it but I can give you the basic logic of how it works

Code:
loop
    java -Xmx2G server.jar //the script will start the server then wait for it to exit before continuing
    zip world/ backup/world-$date-$time -9
/loop
 

Nessiroj

New Member
Jul 29, 2019
855
0
1
Don't know about a script, but running my minecraft servers on windows with a minecraft server software mcmyadmin (MCMA) in my case. In most of the server software programs you can schedule backups / logfile rotations and restarts.
 

Týr

New Member
Jul 29, 2019
4
0
0
Don't know about a script, but running my minecraft servers on windows with a minecraft server software mcmyadmin (MCMA) in my case. In most of the server software programs you can schedule backups / logfile rotations and restarts.
Trying MCMA out right now, fairly easy to set up and it works wonderfully. (and just for the reasons I need as well!) Thank you all :)
 
  • Like
Reactions: Nessiroj