Use the buildin txadmin (if your running the newest fivem) It has its own auto server restart option
Okay so i have literally read every reply on this and can’t figure it out, it keeps giving me this error (https://i.imgur.com/SP84uQ2.png)
I have tried changing it to the server start .bat name etc and i still can’t get it. Its probably just me being stupid but I’ve only been codding for 5 months, self taught to i’m still fresh.
@echo off
RMDIR /s /q "C:\seanserver\cache\files"
echo ----------------------------------
echo -
echo To restart your server, do CTRL + C then "runserver"
echo -
echo ----------------------------------
echo -
echo Press a KEY to launch your server
echo -
pause > nul
CLS
:: CONFIGURATION
TITLE GTA 5 FIVEM SERVER
set reboot=6
set reboot2=12
set reboot3=18
set reboot4=0
set reboot_done=0
set reboot_done2=0
set reboot_done3=0
set reboot_done4=0
set location=C:\seanserver\
:: CONFIGURATION
:start
set dat=%date:~6,4%-%date:~3,2%-%date:~0,2%
set backup=%location%logs\%dat%.txt
:: Backup part
echo [%time%] - Server open
echo [%time%] - Server open >> %backup%
echo [%time%] - Backup start
echo [%time%] - Backup start >> %backup%
xcopy %location%\"resources" %location%\backups\"%dat%" /E /H /R /Y /I /D >> %backup%
echo [%time%] - Backup complete
echo [%time%] - Backup complete >> %backup%
:: Backup part
:: Launch party
start %location%run.cmd +exec server.cfg %*
:: Launch party
goto loop
:loop
timeout /t 30>null
set tps=%TIME:~-0,2%
if %tps% == %reboot% (
if %reboot_done% == 0 (
echo [%time%] - We close the server for reboot && echo [%time%] - We close the server for reboot >> %backup%
taskkill /IM cmd.exe /FI "WINDOWTITLE ne GTA 5 FIVEM SERVER*" >> %backup%
echo ----------------------------------------------------------------------
set reboot_done=1
goto start
) else (
goto loop
)
) else (
set reboot_done=0
goto loop
)
:: Launch part 2
goto loop
:loop
timeout /t 30>null
set tps2=%TIME:~-0,2%
if %tps2% == %reboot2% (
if %reboot_done2% == 0 (
echo [%time%] - We close the server for reboot && echo [% time%] - We close the server for reboot >> %backup%
taskkill /IM cmd.exe /FI "WINDOWTITLE ne GTA 5 FIVEM SERVER*" >> %backup%
echo ----------------------------------------------------------------------
set reboot_done2=1
goto start
) else (
goto loop
)
) else (
set reboot_done2=0
goto loop
)
:: Launch part 3
goto loop
:loop
timeout /t 30>null
set tps3=%TIME:~-0,2%
if %tps3% == %reboot3% (
if %reboot_done3% == 0 (
echo [%time%] - We close the server for reboot && echo [% time%] - We close the server for reboot >> %backup%
taskkill /IM cmd.exe /FI "WINDOWTITLE ne GTA 5 FIVEM SERVER*" >> %backup%
echo ----------------------------------------------------------------------
set reboot_done3=1
goto start
) else (
goto loop
)
) else (
set reboot_done3=0
goto loop
)
:: Launch part 4
goto loop
:loop
timeout /t 30>null
set tps4=%TIME:~-0,2%
if %tps4% == %reboot4% (
if %reboot_done4% == 0 (
echo [%time%] - We close the server for reboot && echo [% time%] - We close the server for reboot >> %backup%
taskkill /IM cmd.exe /FI "WINDOWTITLE ne GTA 5 FIVEM SERVER*" >> %backup%
echo ----------------------------------------------------------------------
set reboot_done4=1
goto start
) else (
goto loop
)
) else (
set reboot_done4=0
goto loop
)
I can see your issue, you may be running something that doesn’t exist.
change
start %location%run.cmd +exec server.cfg %*
to
start %location%ServerStarter.bat +exec C:\CFXServer1\cfx-server-data\server.cfg %*
in the example I provided, ServerStarter.bat is how I would normally run my server. In your case you would put your file that you use to run your server ex: run.bat or runmyserver.bat Also be sure to specify where your server cfg is located if it isn’t in the same directory as the restart.bat file. Hope this helped.
@seanharrison Just use TXAdmin, it has auto restarter built into it. And nothing to change or install, its default with FiveM.
never heard of it, i’ll check it out thanks!
Hello, I had a little question when the auto reboot arrives my server “cmd” does not cut it it gives me a new “cmd” did you know where it came from please
This Script Deleted my Server 100% Use it with Caution… Luckily I did a back up yesterday.
If you set the cache directory, you can most definitely wipe your entire server. It’s a fine example of why you shouldn’t just grab and use stuff without learning how it works.
would be better if it was in english…
coulda said it was in a different laguage…
Translating it is comically simple. If you need this resource and translating it is a hurdle for you, perhaps you shouldn’t be running a server.
lol sorry i havnt translated code before i only work with english coding thanks! i have ran pleanty
u should translate it for everyone if its so easy lets see if u can do it
Oh, you psychological mastermind, you.
but how was this automatic restart done and all my server was deleted
Uh oh. Someone’s angry.