auto restart after crash
#1

If the server is crashed, can it be auto restarted?
Please tell me, because I just had 27 players in my server (new record) and it crashed.
Reply
#2

Well assuming you're on Windows, then you need some sort of code to monitor the server process. I still have a batch file made by yom ages ago, here's the source code. Just open a text file and save as a .bat, then put it in your server directory and run it.

Code:
@ECHO OFF
TITLE Yom's SA-MP server restarter
COLOR 09

SET option_log=0

SET folder=restarter
SET file_1=server_log.txt
SET file_2=%folder%\server.log
SET file_3=%folder%\restarter.log
SET file_4=%folder%\reset.reg
SET server=samp-server.exe
SET count=0
SET regkey="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug"



IF NOT EXIST %server% (

	COLOR 0C
	ECHO %server% was not found!
	ECHO Press any key to exit.
	PAUSE > NUL
	GOTO EOF
)



IF NOT EXIST %folder% MD %folder%



IF NOT EXIST %file_4% (

	REG EXPORT %regkey% %file_4% > NUL
	REG ADD %regkey% /V Auto /D 1 /F > NUL
	REG ADD %regkey% /V Debugger /D 0 /F > NUL
)



:START

	CLS & ECHO.

	SET hh=%time:~0,2%

	IF %hh% LSS 10 SET hh=0%time:~1,1%

	SET msg=[%date%][%hh%:%time:~3,5%] Server

	IF %count% EQU 0 (SET msg=%msg% started.) ELSE SET msg=%msg% restarted [%count%x].

	ECHO  %msg% & ECHO %msg%>> %file_3%

	IF %option_log% EQU 1 (

		ECHO %msg%>> %file_2%
		TYPE %file_1%>> %file_2%
		FOR /L %%i IN (1,1,4) DO ECHO.>> %file_2%
	)

	GOTO NEXT



:NEXT

	SET /A count+=1
	CALL %server%
	GOTO START



:EOF
Reply
#3

omg thanks you.
but where should I set my folder?
Reply
#4

Quote:
Originally Posted by timothyinthehouse
View Post
omg thanks you.
but where should I set my folder?
That variable just defines where the restarter logs are stored, set it to whatever name you want.
Reply
#5

ive did this:

SET folder=C:\Users\Timothy\Desktop\0.3c rc8

but it is not working?
Reply
#6

Did you place the .bat file in the same directory as the samp-server.exe like I said? Also you do not need to put the entire path to your SA-MP server in the folder variable, it just needs the subdirectory where you want to save the restarter logs.
Reply
#7

aha ok, thnx
Reply
#8

Is there a way to do this on linux?
Reply
#9

Quote:
Originally Posted by [FAT]Klabauter[LST]
View Post
Is there a way to do this on linux?
We see your a client with us.

Your server is crashing due to the DDOS attack that is going on with one of our other clients, were taking action towards him and restoring this server at this time.

Please check your email for details in regards to this.

Thanks.
Reply
#10

Follow this thread: https://sampwiki.blast.hk/wiki/Linux_Ser..._Server_Online
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)