diff options
-rw-r--r-- | Changelog-Renewal.txt | 1 | ||||
-rwxr-xr-x | charserv-sql.bat | 11 | ||||
-rwxr-xr-x | charserv.bat | 11 | ||||
-rwxr-xr-x | logserv-sql.bat | 11 | ||||
-rwxr-xr-x | logserv.bat | 11 | ||||
-rwxr-xr-x | mapserv-sql.bat | 11 | ||||
-rwxr-xr-x | mapserv.bat | 11 | ||||
-rwxr-xr-x | serv.bat | 59 |
8 files changed, 72 insertions, 54 deletions
diff --git a/Changelog-Renewal.txt b/Changelog-Renewal.txt index 01d031adf..a3426bd21 100644 --- a/Changelog-Renewal.txt +++ b/Changelog-Renewal.txt @@ -3,6 +3,7 @@ Date Added 2010/11/22 * mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei] * Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275). [Ai4rei] + * Batch files (Windows) now detect whether the server crashed, aborted or shutdown cleanly (Ctrl+C or @mapexit) and print appropriate message, instead of always assuming, that the server crashed (bugreport:3476, since r1818). [Ai4rei] 2010/11/21 * Added msinttypes (rev. 26, http://msinttypes.googlecode.com/svn/trunk/) portability framework for Visual C++ compilers (related bugreport:4059). [Ai4rei] * Added 64-bit variants of the socket and buffer I/O macros. [Ai4rei] diff --git a/charserv-sql.bat b/charserv-sql.bat index 90b58b205..c88168475 100755 --- a/charserv-sql.bat +++ b/charserv-sql.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -char-server_sql.exe -echo . -echo . -echo Char server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat char-server_sql.exe Char-Server diff --git a/charserv.bat b/charserv.bat index cda0f4eb4..b21efac35 100755 --- a/charserv.bat +++ b/charserv.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -char-server.exe -echo . -echo . -echo Char server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat char-server.exe Char-Server diff --git a/logserv-sql.bat b/logserv-sql.bat index 3280c4095..e38daa6d5 100755 --- a/logserv-sql.bat +++ b/logserv-sql.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -login-server_sql.exe -echo . -echo . -echo Login server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat login-server_sql.exe Login-Server diff --git a/logserv.bat b/logserv.bat index 9ea82e4c0..a36e07f17 100755 --- a/logserv.bat +++ b/logserv.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -login-server.exe -echo . -echo . -echo Login server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat login-server.exe Login-Server diff --git a/mapserv-sql.bat b/mapserv-sql.bat index ae65d3be3..9938a25f1 100755 --- a/mapserv-sql.bat +++ b/mapserv-sql.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -map-server_sql.exe -echo . -echo . -echo Map server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat map-server_sql.exe Map-Server diff --git a/mapserv.bat b/mapserv.bat index d9eee9f6e..fc6235092 100755 --- a/mapserv.bat +++ b/mapserv.bat @@ -1,9 +1,2 @@ -@echo off -rem Writen by Jbain -:end -map-server.exe -echo . -echo . -echo Map server crashed! restarting in 15 seconds! press ctl+C to cancel restart! -PING -n 15 127.0.0.1 >nul -goto end
\ No newline at end of file +@ECHO OFF +CALL serv.bat map-server.exe Map-Server diff --git a/serv.bat b/serv.bat new file mode 100755 index 000000000..6e8037faa --- /dev/null +++ b/serv.bat @@ -0,0 +1,59 @@ +@ECHO OFF +IF "%1"=="" GOTO DIRECT +IF "%2"=="" GOTO DIRECT +IF NOT EXIST "%1" GOTO NOTFOUND +GOTO START + +REM == How RESTART_9X and RESTART_NT works ========================= +REM On Windows 9x only the first 8 characters are significant for +REM labels, and the first matching one is called (RESTART_(9X)). +REM Windows NT calls the exact named label (RESTART_NT). +REM Separation between 9X and NT is required, because CHOICE has +REM different syntax on these platforms or does not exist as all. +REM ================================================================ + +REM Windows 95, 98, ME +:RESTART_9X +REM Old Ctrl+C in PING does not work, because that only stops ping, +REM not the batch file. +CHOICE /C:rc /N /T:R,15 Restarting in 15 seconds, press 'C' to cancel. +IF NOT ERRORLEVEL 2 GOTO START +GOTO END + +REM Windows 2000, XP, Vista, 7 +:RESTART_NT +REM There is no CHOICE in 2000 and XP, but you get asked whether to +REM abort the batch file, when pressing Ctrl+C in PING. +ECHO Restarting in 15 seconds, press Ctrl+C to cancel. +PING -n 15 127.0.0.1 > NUL + +:START +%1 +ECHO. +REM Return value > 1 is exception&~0xC0000000 +IF ERRORLEVEL 2 GOTO CRASHED +REM Return value 1 is EXIT_FAILURE +IF ERRORLEVEL 1 GOTO EXIT1 +REM Return value 0 is EXIT_SUCCESS +ECHO %2 has shutdown successfully. +GOTO RESTART_NT + +:EXIT1 +ECHO %2 has terminated abnormally. +GOTO RESTART_NT + +:CRASHED +ECHO %2 has crashed! +GOTO RESTART_NT + +:DIRECT +ECHO Do not run this file directly. It is used by logserv.bat, charserv.bat, +ECHO mapserv.bat and their '-sql' counterparts. +GOTO END + +:NOTFOUND +ECHO %1 was not found. Make sure, that you have compiled the %2. +GOTO END + +:END +PAUSE |