I have a minecraft server running in screen, and right now, it is just a script that starts java like so:
screen -dmS mc java -Xincgc -Xms1024M -jar craftbukkit-1.6.4-b2882.jar
Basically this just starts minecraft in a screen container in the background, and I can access it with screen -r mc
through SSH. However, what I would like to do, is have the process always up on the server monitor, and also accessible through ssh with screen -x mc
. Also, I have a restart.sh script that stuffs the stop command to the mc process every two hours, then it executes the start.sh script. The server is at runlevel 3, so I don't think gnome-terminal -e "screen -x mc"
will work. Also, it seems like the restart script is starting mc outside of screen. When I SSH into the server, screen -ls
turns up nothing, but the minecraft server process is running and I can connect to it. Here's the script:
#!/bin/sh
screen -x mc
screen -s mc stuff "say Server Restarting in 15 minutes."
screen -s mc -X eval "stuff \015"
sleep 600
screen -x mc
screen -x mc -X stuff "say Server restarting in 5 minutes."
screen -s mc -X eval "stuff \015"
sleep 240
screen -x mc
screen -s mc -X stuff "say Server restarting in 1 minute."
screen -s mc -X eval "stuff \015"
sleep 60
screen -S mc -X stuff "say Server restarting."
screen -S mc -X eval "stuff \015"
screen -S -X stuff "kickall Server Restarting, it should be back up in about a minute."
screen -S mc -X eval "stuff \015"
sleep 2
screen -S mc -X stuff "stop"
screen -S mc -X eval "stuff \015"
sleep 30
screen -wipe
sleep 3
cd /minecraft/server/craftbukkit
./start.sh
Any ideas?