“ForgeAutoShutdown”针对 1.10.2 的 1.12.2 分支(仓库)
本模组必须同时安装在客户端和服务端。它不会在单人世界中添加任何命令,但对于本地化消息是必需的。
ForgeAutoShutdown 是一个可以:
- 计划服务器在特定时间或运行 X 小时 X 分钟后自动关闭。这允许通过 Shell 脚本、Windows 批处理文件或系统服务来自动重启服务器。
- 允许玩家投票决定手动关机,这样当服务器卡顿时无需管理员介入即可关闭。
- 关闭或终止挂起(停滞)或严重卡顿的服务器。
要求
- Minecraft Forge 服务端 1.12.2,运行 14.23.5.2859
- 一个在关机后重启服务器的包装脚本(可选,但强烈建议)。
功能
以下功能均可在配置文件中禁用
计划关机
ForgeAutoShutdown 将在服务器启动时以 INFO 级别记录一条消息,包含下次计划关机的日期和时间。例如:
[10:50:09] [Server thread/INFO] [ForgeAutoShutdown]: Next automatic shutdown: 08:30:00 09-June-2019
如果缺少此消息,说明模组未正确安装或配置中已禁用计划任务。如果模组安装在 Minecraft 客户端上,它将向控制台记录 ERROR 错误且不会执行任何功能。它不会导致客户端崩溃或禁用。
模式
默认情况下,关机将安排在一天中的特定时间进行。这是服务器本地的时间,并且总是在服务器启动后的 24 小时内发生。这意味着如果服务器启动时错过了关机时间(即使只几分钟),它也会安排到第二天。
或者,将 Uptime 设置为 true 意味着服务器可以在经过特定的小时数或分钟数后关机。这允许服务器每天多次重启,或在几天后重启等。
警告
默认情况下,计划的关机会在预定时间后每分钟向所有玩家发出一次警告,持续五分钟。可以通过将 Warnings 设置为 false 来禁用此功能。这意味着服务器将在预定时间无声地关闭。
延迟
如果需要,如果服务器上仍有玩家,关机可以延迟一段可配置的时间。要启用此功能,请将 Delay 设置为 true,并调整 DelayBy 为延迟的分钟数。
只要服务器不为空,关机将被反复延迟。在检查服务器是否有玩家时,会排除假人玩家。注意,延迟模式下关机警告无效,如果在倒计时期间有玩家上线,待处理的关机将被取消。
投票
如果启用,玩家可以投票进行手动关机。为此,一名玩家必须执行 /shutdown。然后,所有玩家(包括发起投票的玩家)必须使用 /shutdown yes 或 /shutdown no 进行投票。
如果 no 票达到最大阈值,投票失败。如果投出票数后在此期间有太多玩家断开连接,投票也会失败。如果投票失败,在配置的分钟数过去之前,无法开始新的投票。
如果投票成功,服务器将立即无声关闭。如果设置了适当的自动重启机制,预计服务器将在几分钟后重新启动。
看门狗(实验性)
如果启用,看门狗线程可以定期检查服务器是否无响应。默认情况下,它每 10 秒检查一次:
- 服务器是否在某个刻(tick)上卡住(或“停滞”)
- TPS 是否在一段时间内低于某个特定值
如果检测到上述任一问题,看门狗将尝试软关闭(如果配置了硬关闭则执行硬关闭)。这将使服务器在关闭前尝试保存所有数据。如果软关闭超过十秒,看门狗将执行硬关闭。
A 1.12.2 Fork of "ForgeAutoShutdown" for 1.10.2 (Repository)
This mod must be installed on both client and server sides. It doesn't add any commands to SP worlds, but is necessary for localized messages.
ForgeAutoShutdown is a mod that can:
- Schedule the server to automatically shut down at a specific time of day, or after X
hours and minutes of uptime. This allows the server to be automatically restarted by a
shell script, Windows batch file or service.
- Allow players to vote for a manual shutdown, so a lagged out server does not require
admin intervention
- Shutdown or kill a server that is hung (stalled) or laggy
Requirements
- Minecraft Forge server 1.12.2, running forge 14.23.5.2859
- A wrapper script that restarts the server after shutdown (optional, but highly recommended).
Features
Any of these features may be disabled in the config
Scheduled shutdown
ForgeAutoShutdown will log a message at the INFO level on server startup, with a date and
time of the next scheduled shutdown. For example:
[10:50:09] [Server thread/INFO] [ForgeAutoShutdown]: Next automatic shutdown: 08:30:00 09-June-2019
If this message is missing, the mod has not been correctly installed or the schedule is
disabled in config. If the mod is installed on a Minecraft client, it will log an ERROR to
the console and not perform any function. It will not crash or disable the client.
Mode
By default, the shutdown will be scheduled to happen at a specific time of day. This is
the time local to the server and will always happen within the next 24 hours after server
startup. This means that if the server starts and has missed the shutdown time even by a
few minutes, it will schedule for the next day.
Alternatively, setting Uptime to true means the server can shutdown after a specific
amount of hours or minutes instead. This can allow the server to restart multiple times a
day, or after a few days, etc.
Warnings
By default a scheduled shutdown will give a warning to all players, each minute for five
minutes, after the scheduled time. This can be disabled by setting Warnings to false.
This means the server will shutdown, without warning, by the scheduled time.
Delay
If desired, the shutdown can be delayed by a configurable amount if players are still on
the server. To enable this, set Delay to true and adjust DelayBy to the amount of
minutes to delay.
The shutdown will be repeatedly delayed until the server is empty. When checking if the
server for players, fake players are excluded. Note that shutdown warnings are ineffective
with delays, and a pending shutdown will be cancelled if a player comes online during the countdown.
Voting
If enabled, players may vote a manual shutdown. To do so, a player must execute
/shutdown. Then, all players (including the vote initiator) must vote using
/shutdown yes or /shutdown no.
If the amount of no votes reach a maximum threshold, the vote fails. If a vote is cast
and too many players have disconnected in the meantime, the vote fails. If a vote fails,
another one will not be able to start until a configured amount of minutes has passed.
If the vote succeeds, the server will instantly shutdown without warning. If an
appropriate means of automatic restart is in place, it should be expected that the server
will go up within a few minutes.
Watchdog (Experimental)
If enabled, a watchdog thread can periodically watch the server for unresponsiveness. By
default, it checks every 10 seconds:
- Whether the server is hanging (or "stalling") on a tick
- Whether the TPS stays below a certain amount for a certain length of time
If either problem is detected, the watchdog will try a soft kill (or a hard kill, if
configured). This makes the server try to save all its data before shutting down. If a
soft kill takes longer than ten seconds, the watchdog will do a hard kill.
评论 0
登录后参与评分
还没有评论,来抢沙发吧