0

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!
SomethingDark
  • 13,229
  • 5
  • 50
  • 55
TylerTotally
  • 113
  • 1
  • 2
  • 9
  • Seems pretty close tohttp://stackoverflow.com/questions/15602687/batch-file-restart-program-after-every-20-minutes – Andy Hoffner May 29 '15 at 02:09
  • 1
    Are you literally using `/IM Minecraft server`? Because you're supposed to be using the name of the exe file of the minecraft server (minecraft_server.exe or whatever it is). – SomethingDark May 29 '15 at 03:00
  • I am not that Is what I did the first time I tried it again and put minecraft_server1.8.5.exe Minecraft server was just the window title. And like I said... I am new to Batch – TylerTotally May 29 '15 at 10:45
  • Is "minecraft_server.1.8.5" is a shortcut? Look in the properties of the shortcut to find out what it runs - it's probably going to be `java.exe`, and so you'll risk force-quitting every Java process when you run that. If it's not a shortcut, try `tasklist` when the server's running - it will be one of those process names that `taskkill` will work on. – TessellatingHeckler May 29 '15 at 22:42

1 Answers1

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.

Albert MN.
  • 713
  • 1
  • 16
  • 33
  • Tyler, please listen to this answer. You've asked the same question [three](http://stackoverflow.com/questions/30539878/how-to-i-make-a-bat-that-targets-a-program-and-types-in-a-text-box) [times](http://stackoverflow.com/questions/30540934/in-batch-how-do-i-use-taskkill-properly) and got the same response all three times. Use a Minecraft-specific plugin to do this, not a batch file. – Ryan Bemrose May 30 '15 at 18:45