批量需要Minecraft服务器自动重启脚本 [英] Need auto-restart script in batch for minecraft server

查看:250
本文介绍了批量需要Minecraft服务器自动重启脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前是私人Minecraft服务器上的管理员,尽管在这种情况下,技术问题不在典型的Minecraft支持范围之内.

I am currently an administrator on a private Minecraft server, though in this case the technical question lies outside the scope of typical minecraft supoort.

我希望启动服务器的批处理文件在凌晨12点和中午12点重新启动,尽管我在批处理方面经验很少,而且粗略的Google搜索没有帮助.

I wish to have the batch file that launches the server restart at 12 am and 12 pm, though I have little experience in batch and a cursory google search brings up nothing helpful.

我碰到的一个问题是,我不知道批处理是否可以在Java服务器控制台中执行命令,是否仅由于了解基本批处理功能而发送命令以保存服务器,然后退出并重新启动自身.

The issue I run into is both that I have no idea if batch CAN execute commands within a java server console, send the commands to save the server and then exit, and restart itself, due to only knowing basic batch functions.

更具体地说,我希望批处理文件本身在43200秒之后或在每个12秒后在服务器窗口中运行命令,然后重新启动自身.我不知道如何获取批处理文件以在服务器命令行中运行命令,或者甚至可能.

More specifically, I want the batch file itself to run a command in the server window after either 43200 seconds or on each of the 12s, then restart itself. I do not know how to get a batch file to run a command within the server command line, or if it's even possible.

当前批处理代码如下:

@echo off
:Minecraft
echo (%time%) Minecraft started.
java -Xms2048m -Xmx2048m -XX:PermSize=128m -jar FTBServer-1.6.4-965.jar nogui
pause
echo (%time%) WARNING: Minecraft closed or crashed, restarting.
ping 1.1.1.1 -n 1 -w 3000 >nul
goto Minecraft

任何帮助将不胜感激.谢谢.

Any help would be aprreciated. Thanks.

推荐答案

我使用它,但是如果您希望它自动重新启动,则只需删除:choise部分并从头到尾进行循环

i use this but if you want it to restart it automatically then just delete the :choise part and make a loop from start to restart

@echo off
title minecraft-server-1.8.3
color 0A
prompt [server]:
cls

:start
echo loading server...
java -Xms3G -Xmx3G -jar minecraft_server.1.8.3.jar nogui
cls

:choice
set /P a=do you want to restart[Y/N]?
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

ps.将minecraft_server.1.8.3.jar替换为服务器文件的名称

ps. replace minecraft_server.1.8.3.jar with the name of your server file

这篇关于批量需要Minecraft服务器自动重启脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆