First, this is my first post in this forum, so I hope this is in the right place and that someone can help me with my problem. If this isn't the right sub-forum, please let me know, so that I can post this in the correct palce.
I am hosting my own vanilla Minecraft server for myself and some friends on a Windows 7 computer. Things are running fine, mostly, except that lag seems to increase after two or three straight days of uptime. Restarting the minecraft server resolves this problem. So I was hoping to automate the restarts, but something isn't working correctly.
Here is the content of the batch file created to stop and restart the server.
title run-minecraft
path=%PATH%;%C:\"Program Files"\Java\jre7\bin
C:
cd minecraft
java.exe -Xms2G -Xmx2G -jar minecraft_server.1.7.4.jar
The issue I'm having is that, when using Windows Task Scheduler to automate the script, only the portion of the script that stops Java is working. The portion of the script used to start Minecraft isn't working... but it only fails to work when the script is automated. If I just execute the batch file from the desktop, the server closes, waits, then restarts itself like it should. Additionally, I have a second automated command to restart the computer once a week, with Minecraft to start once the computer is running. This script is nearly identical to the restart script, except that it doesn't kill Java first (because it doesn't need to).
I am at a loss. Is there a better way to automate the restart of my vanilla server? Is there something wrong with my script? If I want automatic restarts, do I need to switch over to something like Bukkit?
I am hosting my own vanilla Minecraft server for myself and some friends on a Windows 7 computer. Things are running fine, mostly, except that lag seems to increase after two or three straight days of uptime. Restarting the minecraft server resolves this problem. So I was hoping to automate the restarts, but something isn't working correctly.
Here is the content of the batch file created to stop and restart the server.
PING 1.1.1.1 -n 1 -w 6000 > NUL
title run-minecraft
path=%PATH%;%C:\"Program Files"\Java\jre7\bin
C:
cd minecraft
java.exe -Xms2G -Xmx2G -jar minecraft_server.1.7.4.jar
The issue I'm having is that, when using Windows Task Scheduler to automate the script, only the portion of the script that stops Java is working. The portion of the script used to start Minecraft isn't working... but it only fails to work when the script is automated. If I just execute the batch file from the desktop, the server closes, waits, then restarts itself like it should. Additionally, I have a second automated command to restart the computer once a week, with Minecraft to start once the computer is running. This script is nearly identical to the restart script, except that it doesn't kill Java first (because it doesn't need to).
I am at a loss. Is there a better way to automate the restart of my vanilla server? Is there something wrong with my script? If I want automatic restarts, do I need to switch over to something like Bukkit?
Thank you in advance for any assistance offered.
What you will want to do is look into batch scripting where you will have a launcher that will stop and start the server on a schedule