Server Help

ASSS Custom Projects - Windows Restarter Script

Bak - Tue Mar 08, 2005 5:12 pm
Post subject: Windows Restarter Script
Been looking (not too hard) for a script for windows that would restart ASSS when it crashes similar to the Linux script that comes with ASSS. I figured it out and throught it would be useful information to share:

First off change your asss.bat slightly
Quote:

@echo off

ECHO starting asss...

GOTO START

:START

bin\asss.exe

IF ERRORLEVEL 5 GOTO MODLOAD
IF ERRORLEVEL 4 GOTO MODCONF
IF ERRORLEVEL 3 GOTO OOM
IF ERRORLEVEL 2 GOTO GENERAL
IF ERRORLEVEL 1 GOTO RECYCLE
IF ERRORLEVEL 0 GOTO SHUTDOWN

ECHO unknown exit code: %ERRORLEVEL%, restarting server(possible crash).

GOTO START


:SHUTDOWN
ECHO asss exited with shutdown.
GOTO END

:RECYCLE
ECHO asss exited with recycle.
GOTO START

:GENERAL
ECHO asss exited with general error.
GOTO END

:OOM
ECHO asss out of memory. restarting.
GOTO START

:MODCONF
ECHO asss cannot start. bad modules.conf.
GOTO END

:MODLOAD
ECHO asss cannot start. error loading modules.
GOTO END

:END


Then you have to disable the default windows error reporting system so it'll restart right away (instead of waiting you you to press send error report, debug, or cancel). All you have to do is get the process to execute the code, so you have lots of choices here. You could recompile your ASSS core and do it in main (probably the most correct solution), or just pick any custom module that always loads when your server loads and put this line in your LOAD event:

Code: Show/Hide
SetErrorMode(SEM_NOGPFAULTERRORBOX); // disable windows error report box


worst case scenerio it sets the error mode more than once, which won't hurt anyone.

Note that you won't be able to debug your modules using the Just in time debugging, as it won't prompt you for it (it'll just restart the server).
Night_Fox - Wed Mar 09, 2005 6:49 am
Post subject:
Eeks thats really too complex for me icon_lol.gif
I think I will start learning now, as I got time in my hands sa_tongue.gif
Anonymous - Wed Mar 09, 2005 11:19 am
Post subject:
finally, cyan can put something on his server so my zone wont be down...
Cyan~Fire - Wed Mar 09, 2005 4:37 pm
Post subject:
Cham, there's like a 10s delay before asss times out and restarts when yours crashes. So stop complaining! icon_razz.gif
Phyran - Thu Mar 10, 2005 12:36 pm
Post subject:
lies! D:
D1st0rt - Fri Mar 11, 2005 12:04 am
Post subject:
I think the better solution is to stop zones from crashing in the first place biggrin.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group