[Release] Auto Restart Server

It deleted everything so there is no backup. Thats what I am saying you shoulda fucking point that shit out you dumbass!

You have to point out that your fucking script deletes files!

indeed, the algorithm removes the files of people who have Down Syndrome

5 Likes

You are the one that created the fucking script and wrote those instructions you motherfucker!

1 Like

It only deletes the cache folder IF you set it up correctly. If it deleted more than that, you may have replaced the second line with your root FXserver directory… in which case it deleted everything and did not back it up. The instructions are quite clear.

2 Likes

If it is correctly configured, the tool ONLY removes the cache and nothing else.But errors happen when we don’t know what we are doing.

1 Like

I see no info on here saying it deletes the caches?

I indicated that in line 2 it was necessary to put its direction path, and it is put by default :
RMDIR /s /q “C:\FXServer\cache\files”
It is clearly marked that the cache is deleted
Then even if you do not understand anything about the code, “(YourServerName) \ cache \ files” is common to all the servers, so it’s just necessary to replace by your directory as it is written

1 Like

I keep getting this issue. I have it set up correctly. Can someone tell me what I have done wrong? It just keeps restarting the server over and over as well. showingcantfindfolder

show me your restart.bat

The only thing I did was change the location and translate it into Englishrestart.bat (3.4 KB)
.

Indeed, it did not work in mine either, my cmd showed me the same mistakes as you. So after trying all the possible fixes, I copied pasted the same thing as before, and it was “magically” working. So try to put this text at the same place of your old :

set location=C:\FXServer\

:: CONFIGURATION

:start

set dat=%date:~6,4%-%date:~3,2%-%date:~0,2%
set backup=%location%logs%dat%.txt

:: Partie sauvegarde

echo [%time%] - Serveur ouvert
echo [%time%] - Serveur ouvert >> %backup%
echo [%time%] - Lancement de la sauvegarde
echo [%time%] - Lancement de la sauvegarde >> %backup%
xcopy %location%“resources” %location%\backups"%dat%" /E /H /R /Y /I /D >> %backup%
echo [%time%] - Sauvegarde termine
echo [%time%] - Sauvegarde termine >> %backup%

At the beginning, just change your directory and do not translate. After that, try to translate

And delete your backups file, or move it in a other place for the first .bat launching

Still no good. Same issue happens. Just keeps telling me that it can not find the specified path.

Try to use it

https://■■■■■■■■■■■■.net/viewtopic.php?t=165

It’s the same code for create backups as mines
, so try to view if with it it’s working

Even with yours, it still does exactly the same thing. It’s like it doesn’t see that the folders for “backups” and “logs” even exists even though they clearly do.

Unfortunately, I don’t want to put any more effort into this. I’ll stick to using Windows Task Scheduler and a couple separate .bat files for our server restart. Thanks for the help though. I appreciate it!

Hi all!
I was changed a few things, and now working for me.
2nd line: directory path for cache files!
25th line: directory path for server
26th line: directory path for backup

@echo off
RMDIR /s /q "C:\FXServer\cache\files"
echo ----------------------------------
echo -
echo To restart the server, Press CTRL + C then "runserver"
echo -
echo ----------------------------------
echo -
echo Press any key to launch the server.
echo -
pause > nul
CLS

:: CONFIGURATION

TITLE AUTO REBOOT
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:\FXServer\
set backupsLocation=E:\backups\

:: CONFIGURATION

:start

set dat=%date:~6,4%-%date:~3,2%-%date:~0,2%
set backup=%backupsLocation%logs\log.txt

:: Partie sauvegarde

echo [%time%] - Open server
echo [%time%] - Open server >> %backup%
echo [%time%] - Launching the backup
echo [%time%] - Launching the backup >> %backup%
xcopy %location%\"resources" %backupsLocation%\backups\resources\ /E /H /R /Y /I /D  >> %backup%
echo [%time%] - Backup ends
echo [%time%] - Backup ends >> %backup%

:: Partie sauvegarde

:: Partie lancement

start "FIVEM SERVER" %location%run.cmd +exec server.cfg %*

:: Partie lancement

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 eq FIVEM SERVER*" >> %backup%
			echo ----------------------------------------------------------------------
            set reboot_done=1
            goto start
        ) else (
            goto loop
        )
    ) else (
        set reboot_done=0
        goto loop
    )


:: Partie lancement 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 eq FIVEM SERVER*" >> %backup%
			echo ----------------------------------------------------------------------
            set reboot_done2=1
            goto start
        ) else (
            goto loop
        )
    ) else (
        set reboot_done2=0
        goto loop
    )


:: Partie lancement 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 eq FIVEM SERVER*" >> %backup%
			echo ----------------------------------------------------------------------
            set reboot_done3=1
            goto start
        ) else (
            goto loop
        )
    ) else (
        set reboot_done3=0
        goto loop
    )

:: Partie lancement 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 eq FIVEM SERVER*" >> %backup%
			echo ----------------------------------------------------------------------
            set reboot_done4=1
            goto start
        ) else (
            goto loop
        )
    ) else (
        set reboot_done4=0
        goto loop
    )

3 Likes

It’s unnecessary to delete cache for just a simple restart. The only time you would need to do that is if the files have changed which isn’t something that’s happening in this case. That whole element could be safely stripped from the script.

There is absolutely no reason at all for you to clear your server cache at each restart. All you’re doing is increasing load times. The cache only needs to be cleared if it’s corrupted, which rarely happens…

Erasing the cache does not take time, it is to create a backups folder that takes the most time. And as I said above, clearing the cache is prevention.