#!/bin/bash
while true; do
echo "Starting Server"
java -Xms512M -Xmx1G -jar FTB-Beta-A.jar &>> ./console.log &
sleep 3600
echo "Stopping Server"
ps axa |grep " -jar FTB-Beta-A.jar" | awk '{print $1}' | xargs kill &>/dev/null
sleep 5
ps axa |grep " -jar FTB-Beta-A.jar" | awk '{print $1}' | xargs kill -9 &>/dev/null
done
Oh ok, so if you cant give something simplier, please give me the tmux thinghmm.. i cant help with something simpler. sorry, i dont know java, so cant make a mod for that.
Put this in your minecraft-server dir
startserver.sh: http://pastebin.com/heR8RW5L
stopserver.sh: http://pastebin.com/6h26Vsne
put this in /etc/cron.hourly/:
http://pastebin.com/MDR0J5Fw
it has to be executable.
until someone release a better solution, this is the solution I would use.
Modify the scripts to match your needs/system. good luck.
#!/bin/bash
# Sends ingame message
screen -S FTB -X stuff "say Server restart in 5 minutes $(printf '\r')"
# Waits 300 seconds
sleep 300
# Stops the server
screen -S FTB -X stuff "stop $(printf '\r')"
# Wait 10 seconds just to give the server time to shut down and save
sleep 10
# Starts the server
screen -S FTB -X stuff "./Server Start.sh $(printf '\r')"
apt-get screen
screen -S FTB
to do hourly restarts in windows, just write a batch file to shut down your server, wait, then restart it. Then, tell taskmanager to run that batch file at your chosen time.Is this dead? I would need an hourly restart script for windows...
Easiest way is to use screen and just make a shell script telling FTB console in screen to start and restart. Then just add it to your crontab once every hour.
That way you don't need to kill the process in an forced way.
Copy this script and name it what-you-want.sh
Code:#!/bin/bash # Sends ingame message screen -S FTB -X stuff "say Server restart in 5 minutes $(printf '\r')" # Waits 300 seconds sleep 300 # Stops the server screen -S FTB -X stuff "stop $(printf '\r')" # Wait 10 seconds just to give the server time to shut down and save sleep 10 # Starts the server screen -S FTB -X stuff "./Server Start.sh $(printf '\r')"
What is your linux distro? Depends on how to get screen but as Debiansystem you type:
Code:apt-get screen
To open a screen session with the name FTB type:
Code:screen -S FTB
Start your server at the first time and detach the screen session with ctrl+a+d.
Add what-you-wish.sh (the shell script you just created) to your hourly crontab.
And you can just change the value of sleep to increase the time to wait for server restart. Don't forget to change the message also.
Edit: changed start command beginning with ./