问题
I have one problem that could work one of two ways. I am running a Minecraft 1.8.5 server. I want to start it stop it and restart it every hour. The reason why I said one of two ways it because I could either make a batch that types "stop" in the console input (I think this would work better) or Just stop the program all together here is what I have made so far ( I am planning to run this in multiply helper files to close only but any thing will help.
This opens the Minecraft server:
echo.
echo Waiting For One Hour...
TIMEOUT /T 3600 /NOBREAK
echo.
start minecraft_server.1.8.5
echo Minecraft Opened! pause >nul
This I can not get to work (separate file that I will eventually integrate into the first script):
@echo on
TASKKILL /F /IM Minecraft server /T
echo killed!
回答1:
When running a Minecraft server, you serdenly do not want to force kill it like that (talking as an experienced Minecraft server owner). The data will not be saved probberly, and players+the world will lose most, if not all data since last probber restart.
I recommend using a simple plugin for this... As it really is needed to stop a server with 'stop' from the console, or /stop in-game. This might work: http://dev.bukkit.org/bukkit-plugins/auto-shutdown/
If not, or if it doesn't suit your server either, just search up 'Bukkit automatic restart' or 'Spigot automatic restart'
I cannot say it to much: do not stop a server using anything but a program interacting directly with your Minecraft server - in this case, a plugin is your only good option.
来源:https://stackoverflow.com/questions/30519968/batch-text-pasteing-stoping