Troubleshooting - GeheimagentNr1/AutoRestart GitHub Wiki
Rented servers / server panels (i.e. Pterodactyl, Multicraft, BisectHosting)
On a rented server you usually can't run your own scripts, because the server panel starts the Minecraft server.
In this case:
- Enable the option of your server panel, that restarts the server automatically when it stops or crashes (often called "Auto Restart", "Crash Detection" or "Restart on crash").
- Set
use_external_restart_script = truein the "auto_restart-server.toml" config. Therestart_commandis not used then.
When the mod restarts the server, it stops the server and the server panel starts it again.
Note: Many server panels can't tell a restart from a normal stop, so the server is started again after the /stop command too. To stop the server completely, use the stop button of the server panel.
The server stops, but doesn't start again
- Check the server log ("logs/latest.log") for lines starting with "Restart failed". They show, why the
restart_commandcouldn't be started. restart_commandmust only contain the path of the script, without any other commands or arguments (i.e. "/opt/minecraft/start.sh", not "bash /opt/minecraft/start.sh" or "/opt/minecraft/start.sh nogui"). The whole value is used as the name of the program to start.- Use the absolute path of the script.
- On Windows, all "\" in the path have to be "\\" in the config, i.e.
"C:\\Minecraft\\start.cmd". - With
use_external_restart_script = false, a crashed server is only restarted, ifauto_restart.on_crashis true. - Test the script by running it yourself, while the server is stopped. The server must start in the background (Linux: in a screen, Windows: in a new window) and the script must end directly.
Linux: "Permission denied"
The script is not executable. Run chmod +x <Name of your script>.sh.
Linux: /bin/bash^M: bad interpreter or $'\r': command not found
The script was saved with Windows line endings (CRLF), i.e. because it was edited on Windows. Convert it to Linux line endings (LF) with sed -i 's/\r$//' <Name of your script>.sh or dos2unix <Name of your script>.sh, or change the line endings in your editor (i.e. in Notepad++ with "Edit" > "EOL Conversion" > "Unix (LF)").
Linux: cd: too many arguments or the server starts in the wrong folder
The path contains spaces. Put it in double quotes: cd "/opt/minecraft/servers/Minecraft Server".
The restart script hangs or the server is never started
Don't use pause (Windows) or read (Linux) in the script for the restart_command. The script is started by the stopping server and has no console, so it would wait forever or end before starting the server.
This only applies to the script for the restart_command. The restart_loop script of an external restart script runs in its own console and reads only the "auto_restart/restart" file.
The external restart script always restarts the server, even after /stop
The mod writes "0" to the "auto_restart/restart" file in the server folder, if the server was stopped with /stop.
- The script must be started in the server folder (see the
cdin the "restart_start" script), otherwise it reads a wrong or missing file. - If the server was stopped by closing the console window or killing the process, the mod can't write the file and the file still contains "-1" (crash), so the script restarts the server.