[Release] Server Auto Restart

@ArmAGawD

Found out you can put restart sessionmanager in ur server.cfg

Well if that is all it takes thanks for the input i’ll test it here and update my post! Thanks !!

start “Server” C:\users\root\desktop\FXserver\run.cmd +exec server.cfg //starts server with name “Server”

and

taskkill /F /FI “WindowTitle eq Server” //kills the window names “Server”

is the problem that when running both servers only one will actually stay up? as the other one shuts it down? if so im also having this problem and have you fixed it? its doing my head in and have been looking for weeks lol,
thanks in advance
mickie.

I’m looking for a script that will have say in the chat that the server is restarting. from 30 min to 15 to 10 to 5 then 1.
anyone know how to do this?

how to restart server on a spesific time lika a 10.00 pm

i want to know that aswell haha did you figuer it out? :slight_smile:

Simple, but effective. Thanks for sharing with everyone :slight_smile:

Is there a way to close the last opened command window? I imagine thats what taskkill /f /im FXServer.exe is for but should be an exit. Although when using the “exit” command it closes the main restart script…

When the restart happens the last server cmd window stays open and a new server windows appears starting the new server. A minor solution was to start the window minimized but after some hours a bunch of unused batch windows will be open. Any advice?

Here is what I have thus far:

:loop
@echo off
cd /d C:\FiveM
@echo off
cls
@echo Keep This Window Open For Automatic Server Restarts***
@echo Hit Enter In This Window To Restart Server Immediately**
@echo This script will restart the server every 8 hours from the time it is launched
start “FiveM” /min C:\FiveM\run.cmd +exec server.cfg
timeout /t 28800
taskkill /f /im FXServer.exe
@echo Server Shutdown Successfully.
taskkill /F /FI “WindowTitle eq Server”
@echo Server Is Restarting Now.
goto loop

in auto restarts just simply do this

start sessionmanager
restart sessionmanager

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

You could incorporate this in my restart notification script…

How would I do that? Wouldn’t I have to have someone in game to do the command?

I’m not saying to use the whole thing but to use snippets of it…

If i’m right, all your script does is print a message to the chat, right? Well, I do think it is possible to execute other files from lua. So running that bat file through an event, or some shit. I have no idea but I am positive you can execute bat files.

This isn’t relevant to the topic. DM me if you have an issue, Christ.

thank you very much very helpful :slight_smile:

Can i do this with like zap hosting?

ZAP provides an auto-restart system.

1 Like

I assume 3600 = 1 hour?