Cuberite Forum
Shutdown from shell script - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Discussion (https://forum.cuberite.org/forum-5.html)
+--- Thread: Shutdown from shell script (/thread-1283.html)



Shutdown from shell script - Sxw - 12-23-2013

I have a cron shell script that recompiles MCServer every night. How would I safely shutdown and/or restart MCServer from this script? (MCServer runs from screen)


RE: Shutdown from shell script - xoft - 12-23-2013

Use a RCON client to send it the "stop" command.
We have a RCONClient tool in the Tools folder, but I haven't compiled it for anything else than windows yet, so it might take some work.


RE: Shutdown from shell script - bearbin - 12-23-2013

Code:
echo "stop" > /proc/?/fd/0

Maybe that would work?


RE: Shutdown from shell script - Sxw - 12-24-2013

Might, but I'm running in a screen session so I used:
screen -S mcserver -p 0 -X stuff "stop$(printf \\r)"