How do I properly setup an auto-starting server on Windows Server?
It generally doesn't work that great, but you can define you own services. You will need to figure out some way to make sure the service performs a save.
How To Create a User-Defined Service
- http://support.microsoft.com/kb/137890
From SF see these questions.
- https://serverfault.com/questions/55607/help-with-running-an-application-as-a-service-on-server-2008
- https://serverfault.com/questions/75292/looking-for-a-solution-to-allow-a-regular-app-to-run-as-a-service
- https://serverfault.com/questions/58025/install-service-in-windows-server-2008
- https://serverfault.com/questions/12094/how-to-create-a-windows-service-in-xp
Create a schedule task that runs at boot
- http://www.myboogpages.com/2009/02/how-to-create-a-scheduled-task-that-runs-at-boot-time.html
If all else fails, you may have to do as Corey suggests. Configure your server to auto-login as some account, and just place a shortcut in the startup group.
Edit: This app is actually quite mature and reliable now and not really an "early release" anymore. It's still being worked on and recently added support for running multiple servers at the same time (e.g. for trialling the weekly builds).
If you are happy with the "vanilla" experience, I have (as mentioned in comments) made an application that keeps Minecraft running as a service. You can download an early release direct from GitHub which gives you Vanilla Minecraft as a service with a web-based console.
What you're looking for is a tool that can turn any arbitrary Windows process/executable into a Windows service.
There are three tools that I can recommend get the job done:
- SrvAny: Free but requires more in-depth technical detail to setup. Not compatible with ALL apps.
- FireDaemon: Not free but is extremely reliable and effective. Try the 30-day trial.
- Java Service Wrapper: Free for personal use. Works for java apps.
Set your Windows service as 'Automatic' and you're done!
On a windows machine, you don't need anything fancy or to run anything "as a service". The quickest and easiest way I've done this is using task scheduler. Simply create a basic task and point the "task/script" at the java executable (with full path): "C:\Program Files (x86)\Java\jre1.8.0_25\bin\java.exe"
and then in the optional parameters: (some of these could be wrong, but hey, it's an example) -Xms1024M -Xmx1024M -jar craftbukkit-1.7.2-R0.3-20131221.081113-1.jar -o true
I also set a "Start In" path, so I didn't have to fully reference my jar file too: D:\Minecraft
I also have a script that does a backup of the minecraft folder every night that deletes zip files after a few days. I run that at 4:00am.
So on my server I have: - the MC server startup automatically using a scheduled task at 5:00am - minecraft server auto-shutdown at 3:00am - the backup .bat file run at 4:00am - Go back to step 1.. :-)
I hope this helps someone.