[Release] Auto Server Restart

Just did some research and got this working.
Obviously you can change the time and the paths to fit your server location and delete the clear cache bit but here you go.
Make a file called “autostart.bat” and paste this.

:loop
@echo Clearing Server Cache Files
cd /d C:\users\root\desktop\FXserver\
rd /s /q cache
@echo off
cls
@echo Hit Enter In This Window To Restart Server Immediately, Keep This Window Open For Automatic 6 Hour Server Restarts.
start "Server" C:\users\root\desktop\FXserver\run.cmd +exec server.cfg
timeout /t 21600
taskkill /f /im FXServer.exe
@echo Server Shutdown Successfully.
taskkill /F /FI "WindowTitle eq Server"
@echo Server Is Restarting Now.
goto loop
3 Likes

There is absolutely no reason to clear the cache, please don’t put that in your restart script :expressionless:

tbh i dont care about the cache, as long as the auto restart works. You can easily remove that line, and what harm does deleting cache do?

1 Like

is there away to make it restart like 04:00 - 12:00 - 18:00 and so one?

Is there a way to add a chatmessage which announces before the server is restarting?

Code I’m using

:loop
@echo Clearing Server Cache Files
cd /d C:\Users\Administrator\Desktop\
rd /s /q cache
@echo off
cls
@echo Hit Enter In This Window To Restart Server Immediately, Keep This Window Open For Automatic 6 Hour Server Restarts.
start "Server" C:\Users\Administrator\Desktop\run.cmd +exec server.cfg
timeout /t 10800
taskkill /f /im FXServer.exe
@echo Server Shutdown Successfully.
taskkill /F /FI "WindowTitle eq Server"
@echo Server Is Restarting Now.
goto loop

Thanks man :slight_smile:

Backup and Cache Cleaner and restart server

:loop
:: Config Server
set location=C:\Users\admiistrador\Desktop\server06
:: Clear cache
@echo Clearing Server Cache Files
cd /d %location%\
rd /s /q cache
:: Backup log
set dat=%date:~6,4%-%date:~3,2%-%date:~0,2%
set backup=%location%\logs\%dat%.txt
:: Backup
@echo [%time%] - Open server
@echo [%time%] - Open server >> %backup%
@echo [%time%] - Launching the backup 
@echo [%time%] - Launching the backup >> %backup%
xcopy %location%\"resources" %location%\backups\"%dat%" /E /H /R /Y /I /D  >> %backup%
@echo [%time%] - Backup ends
@echo [%time%] - Backup ends >> %backup%
@echo off
cls
@echo Hit Enter In This Window To Restart Server Immediately, Keep This Window Open For Automatic 6 Hour Server Restarts.
:: Start Server
start "Server" %location%\run.cmd +exec server.cfg
timeout /t 21600
taskkill /f /im FXServer.exe
:: Server Shutdown
@echo Server Shutdown Successfully.
taskkill /F /FI "WindowTitle eq Server"
@echo Server Is Restarting Now.
goto loop

Nice command!
but it not stop old cmd

i have this problem

and dont close first window lol

taskill not working