Can you even fix that?
#1

Hey guys,

Sometimes my samp-server.exe just stops when im asleep. It does not show me a crash report so i dont know what the problem is.

Is there a code or a program that will auto restart it again? So i dont have that offline time when iam not awake? Its hosted on a vps.

Thanks so much! Rep++


Found it! Insert it into a .bat !

Код:
@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
#2

You can make use of a .bat file (windows) or .sh file (linux) to restart your server if it crashes.

I don't remember the code and I"m not home but If you wait a bit I'll edit this post and give you the script for it when I get home.
Reply
#3

Thanks but i found it!

If someone needs it!
Reply
#4

Oh, glad you found one. My bat script looked like this, in case anyone wants to try it.

1. Make a .bat file(windows) with the following code.
Код:
:start
samp-server.exe
goto :start
2. Place the file in the main server directory.
3. Double click the .bat file.
Reply
#5

I'd rather figure out why is server crashing instead of figuring out how to make an auto restart batch.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)