From 51891b766c733220b5267be1b4bcf6f04717e976 Mon Sep 17 00:00:00 2001 From: Anthony Birkett Date: Tue, 31 Mar 2015 14:50:03 +0100 Subject: Working as a Windows service. Starts and stops correctly. Added "/service" switch, to prompt the binary to attempt starting as a service. Added service* methods, to control service startup. Split up main() into universalMain(), which contains the startup code for both service and normal start. Added cRoot::m_RunningAsService bool, Added cRoot::SetStopping(bool) to allow a stop request to be sent by the service controller. Added cBlockIDMap::init() to avoid loading items.ini before the working directory has been set. --- MCServer/install_windows_service.cmd | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 MCServer/install_windows_service.cmd (limited to 'MCServer/install_windows_service.cmd') diff --git a/MCServer/install_windows_service.cmd b/MCServer/install_windows_service.cmd new file mode 100644 index 000000000..ba8a8c128 --- /dev/null +++ b/MCServer/install_windows_service.cmd @@ -0,0 +1,7 @@ +rem Alter this if you need to install multiple instances. +@echo off +set SERVICENAME="MCServer" + +set CURRENTDIR=%CD% +sc create %SERVICENAME% binPath= "%CURRENTDIR%\MCServer.exe /service" start= auto DisplayName= %SERVICENAME% +sc description %SERVICENAME% "Minecraft server instance" \ No newline at end of file -- cgit v1.2.3