-2
我爲我的Minecraft服務器製作了一個自定義啓動腳本,所以我可以使用更多的RAM。 當您停止服務器時,它會詢問您是要重新啓動還是要停止。 如果在20秒後沒有應答,我無法自動重新啓動(在發生崩潰的情況下) 。請幫忙。20秒後自動進行選擇
@echo off
title minecraft-server-1.8.3
color 0A
prompt [server]:
cls
:start //starts the server
echo loading server...
java -Xms3G -Xmx3G -jar minecraft_server.1.8.3.jar nogui
cls
[code to restart the server when it didn't get an anwser in 20sec]
:choice //what to do when
set /P a=do you want to restart[Y/N]? the server stops
if /I "%a%" EQU "Y" goto :restart
if /I "%a%" EQU "N" goto :stop
goto :choice
:restart
cls
echo server will restart
TIMEOUT /T 5
cls
goto :start
:stop
cls
echo closing server
TIMEOUT /T 5
exit
應該指出的是,這個命令在Windows XP上不存在,但IMO仍然使用XP的唯一原因是工作。 – SomethingDark 2015-04-06 06:41:06