Auto Restart

Auto Restart

70.3k Downloads

SERVER RESTARTS BUT CMD WINDOW DOES NOT REOPEN ON RESTART.

breeece opened this issue · 9 comments

commented

Versions
Minecraft Version: [e.g. 1.19.3]
Minecraft Forge Version: [e.g. 44.1.17]
Mod Version: [e.g. 2.0.1]

Log files
N/A

Describe the bug
Server auto-restarts fine but CMD window does not open again.

To Reproduce
Steps to reproduce the behaviour:

  1. Launch server.
  2. Wait for scheduled auto-restart or manually do /restart command.
  3. CMD window does not open again. But server restarts and runs fine.
    Expected behaviour
    Server should auto restart and CMD window should open again.
commented
Status:Investigations running
Issue type:tba
Fix type:tba
Fix version:tba
Fix release date:tba

Issue confirmed for:

  • Yes, for default run.bat

TODOs:

  • Check how to fix the issue
commented

What configuration are you used?
Could you send me your config file for the mod?

commented
commented

#Options for restarting:
[restart]
#Is the server started by an external restart script?
use_external_restart_script = false
#Command that is executed on Server stopped to restart the server. Only called if "[restart, use_external_restart_script]" is false.
restart_command = "C:\Users\bdano\AppData\Roaming\.minecraft\run.bat"

#Option for auto restarting:
[auto_restart]
#Should the Server do automatic restarts?
enabled = true
#Times in 24-hour format on which the server will automatically restart
times = ["04:00", "08:00", "12:00", "16:00", "20:00", "00:00"]
#Should the server be automatically restarted when it crashes.
on_crash = true
#Times before an auto restart of the server, a restart warning should be shown.
#Examples:
# - 5s - For a message 5 seconds before a restart
# - 7m - For a message 7 minutes before a restart
# - 2h - For a message 2 hours before a restart
warning_times = ["1h", "5m", "4m", "3m", "2m", "1m", "30s", "10s"]

#Options for restart, if the server is empty:
[on_empty_restart]
#Should the server restart, if no players are online?
enabled = false
#Delay after the server should restart, if it is empty.
#Examples:
# - 5s - For a delay 5 seconds
# - 7m - For a delay 7 minutes
# - 2h - For a delay 2 hours
delay = "10m"

#Options for restart, if the tps of server or its dimensions are low:
[low_tps_restart]
#Should the server restart, if it is below a tps level for a specified time?
enabled = false
#TPS level below which the server is restarted, if it lasts for a specified time.
#Range: 0.0 ~ 20.0
minium_tps_level = 0.0
#Delay, that the server must be below the defined TPS level, in order for it to be restarted.
#Examples:
# - 5s - For a delay 5 seconds
# - 7m - For a delay 7 minutes
# - 2h - For a delay 2 hours
delay = "1m"

run.bat

@echo off
REM Forge requires a configured set of both JVM and program arguments.
REM Add custom JVM arguments to the user_jvm_args.txt
REM Add custom program arguments {such as nogui} to this file in the next line before the %* or
REM pass them to this script directly
java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.19.3-44.1.20/win_args.txt -nogui %*
pause

commented
commented

I was able to reproduce the issue.

Please try removing the "pause" from the run.bat and add a "start" before the "java", so the run.bat looks like this:

@echo off  
REM Forge requires a configured set of both JVM and program arguments.  
REM Add custom JVM arguments to the user\_jvm\_args.txt  
REM Add custom program arguments {such as nogui} to this file in the next line before the %\* or  
REM  pass them to this script directly  
start java @user\_jvm\_args.txt @libraries/net/minecraftforge/forge/1.19.3-44.0.36/win\_args.txt -nogui %\*

Removing the "pause" will make the old "cmd" window disappear, when the server is closed.
And the "start" triggers, that the java is launched in a new cmd window.

commented

Screenshot 2023-03-27 181220
Auto restart and close and opening of new CMD window works as mentioned above. BUT... Now my processes look like this.
Is that normal?

commented

Yes, that looks fine and normal to me.

commented