-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathauthserver-exitcode-script.bat
41 lines (35 loc) · 1.2 KB
/
authserver-exitcode-script.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
@echo off
:start
authserver.exe
:: As authserver cannot manually be restarted it can only be shutdown
:: so we only check for SHUTDOWN_EXIT_CODE and ERROR_EXIT_CODE just incase.
:: By default we do not automatically restart the server.
:: For SHUTDOWN_EXIT_CODE
if %errorlevel% == 0 (
echo Server has Shutdown and will not automatically restart.
echo Shutdown Code is %errorlevel% SHUTDOWN_EXIT_CODE
echo Press any key to restart AuthServer, press CTRL + C to exit.
pause
goto start
)
:: For ERROR_EXIT_CODE
if %errorlevel% == 1 (
echo Server has encountered an error.
echo Shutdown Code is %errorlevel% ERROR_EXIT_CODE
echo Press any key to restart AuthServer, press CTRL + C to exit.
pause
goto start
)
:: As batch doesn't have logical operators...
:: This is what we have to do to not break the script if an
:: unknown errorlevel is provided.
if NOT %errorlevel% == 0 (
if NOT %errorlevel% == 1 (
echo Shutdown Code is unknown.
echo Shutdown Code is %errorlevel%
echo Maybe this was a misstake? AuthServer will not automatically restart
echo Press any key to restart AuthServer, press CTRL + C to exit.
pause
goto start
)
)