Auto Restart

Auto Restart

70.3k Downloads

Mod does not auto restart if server crashed during launch

transbiod opened this issue ยท 13 comments

commented

Versions
Minecraft Version: 1.19.2
Minecraft Forge Version: 43.2.3
Mod Version: 2.0.1

Log files
No errors about this mod

Describe the bug
Server does not auto restart when server crashes during launch

To Reproduce
In my particular case i set up several times for my server to restart and sometimes it just breaks down when launching due to massive amouns of mods. When that happens, it does not auto restart. Last time it happend one of the mods encountered an error during the common_setup event phase.

Expected behaviour
Server restarting after it crashed

Additional context
I use start.cmd because for some reason external script just did not want to work.
This is what i have in it
cd "Z:\Server-Files-1.0.10"
start java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.19.2-43.2.3/win_args.txt

commented

man, u must always start server from new restart_start.cmd - otherwise restart_loop.sh will not start. This is a requirement for mod to work correctly.

No, i mean, there is two ways of using this mod, right? There is restart_start and restart_loop method with (use_external_restart_script = true) and start.cmd method, when you manualy add command to execute in config. And i was using second method before this.

okay
now I know what you mean, but I didn't use the second method.

commented

man, u must always start server from new restart_start.cmd - otherwise restart_loop.sh will not start. This is a requirement for mod to work correctly.

No, i mean, there is two ways of using this mod, right? There is restart_start and restart_loop method with (use_external_restart_script = true) and start.cmd method, when you manualy add command to execute in config. And i was using second method before this.

commented

This issue/pull request has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs.

commented

This issue is still relevant

commented

This issue is still relevant

try this in restart_loop.sh:

if [ "$should_restart" -eq 0 ]

instead

if [ $should_restart == "0" ]

let me know if it worked

commented

I tried to use restart_start.cmd with your suggestion to restart_loop.cmd and it actually worked. But i will need to somehow crash my server now at the setup event to properly test it or wait for it to happen naturaly, as it is pure luck based (or unluck :))))))))))) ).

commented

In any case, this problem will still persist if someone used start.cmd like me before. Or is it a limitation of using this method as oppose to external script?

commented

Oh, and i should mention that i had problems with old server cmd window staying after restarting with start.cmd, but it was fixed when i updated to newer version of forge (43.2.6)

commented

man, u must always start server from new restart_start.cmd - otherwise restart_loop.sh will not start.
This is a requirement for mod to work correctly.

commented

Yeah, even with external restart script, if there is a mod loading failure during launch, server does not automatically restart

commented

The Auto Restart mod is based on the event system of forge, so forge triggers different events, like if the server started or is stopped and so on. If the server crashes, before the mods are initialized the server stopped event is not triggered, and because of that the server will not be restarted with the start.cmd/start.sh file.

With the restart_start.cmd/restart_start.sh and the restart_loop.cmd/restart_loop.sh file, the server is started from an external source, that does not depend on the forge event system for the restart itself. But if the server stopped before successfully, in the auto_restart file in the auto_restart folder will be a "0" and in this case, the server will not be restarted, if is crashes during initialization, because "0" means that the server is supposed to stop.
When the server is successfully started, in the auto_restart file will be a "-1", with which a server crash can be detected, if the server just stops, because of a crash.

commented

This issue/pull request has been automatically marked as inactive because it has not had recent activity. It will be closed if no further activity occurs.

commented

This issue/pull request has been automatically closed because it has not had activity in a long time.