Server loop restart - How?Solved

Hello! So I'm pretty new on this. I want to restart my server every 6 hours. I already set up the timedExecute plugin, but the server doesn't go online. I know I need to insert (below), but I don't know where exactly. Also, I'm losing rustserver.cfg from config-lgsm? because I'm starting my server with ./rustserver start

@echo off
cls
:start
echo Starting server...

--------------

echo.
echo Restarting server...
timeout /t 10
echo.
goto start

Every 6 hours is abit excessive but each to their own.

You're probably better off using a plugin like and timed executables.

https://umod.org/plugins/smooth-restarter

"RealTime-Timer": {
"06:00:00": "srestart restart 120"

that way players on the server will at least get a 2-minute warning the server is about to restart.

not sure what you mean about rustserver.cfg.

But make your own with notpad file and save it as server.cfg
putting in the server configs you want. Put it in the server config folder where users and bans are kept.

You are using LGSM so this is easy, you don't need any plugins. All you need to do is set a cron job:

Open the crontab editor:

crontab -e​
If it's the first time and you get an editor choice, select nano, then when you're in edit mode paste this line:
0 */6 * * * ~/rustserver r​
CTRL-X to exit/save and that's it.
htmlSh3wbejUsbb.png JimDeadlock

You are using LGSM so this is easy, you don't need any plugins. All you need to do is set a cron job:

Open the crontab editor:

crontab -e​
If it's the first time and you get an editor choice, select nano, then when you're in edit mode paste this line:
0 */6 * * * ~/rustserver r​
CTRL-X to exit/save and that's it.
Forcing a restart is never a good solution, that will open you up to potential save and data corruption. Best to shutdown gracefully.

You can use the TimedExecute plugin to run 'save' and 'say SERVER RESTARTING' commands a few seconds before restarts to avoid any loss of progress. I've been doing this daily for years with no issues.

LGSM has 11 different options for stop methods (ctrl-c, tmux kill, quit.. etc) so if you have any issues you can try a different one, but I've had no problems with default. Find '## Stop Mode' in ~/lgsm/config-lgsm/rustserver/_default.cfg to see the options.

Merged post

https://docs.linuxgsm.com/features/stop-mode

I'm already using TimedExecute (like I said on the first post), but the server only goes down. I need to start the server manually. That's why I'm asking because I'm confused, I have a rustserver.cfg in lgsm-config and server.cfg in serverfiles, both edited when I installed the server. Don't know if it will affect the server if I'm making another start server using .sh.

Plugins are not able to start the rustserver, they can only stop it. Even the ones with title "Restart" are misleading because they can't start it. Think about it. After the server has been shut down then how does a plugin do anything if it's not running? TimedExecute is good for preparing for shutdown (save and player notifications) but you need an external process to restart the server.

rustserver.cfg is for setting server initialisation parameters (port numbers etc) and server.cfg is for other startup parameters, but neither of these controls the actual restart process.

Why don't you actually try the suggestions you've been given, and if they don't work for whatever reason you can come back here for troubleshooting tips, but it's not helping anyone if you just say you're confused without trying anything.

htmlSh3wbejUsbb.png JimDeadlock

Plugins are not able to start the rustserver, they can only stop it. Even the ones with title "Restart" are misleading because they can't start it. Think about it. After the server has been shut down then how does a plugin do anything if it's not running? TimedExecute is good for preparing for shutdown (save and player notifications) but you need an external process to restart the server.

rustserver.cfg is for setting server initialisation parameters (port numbers etc) and server.cfg is for other startup parameters, but neither of these controls the actual restart process.

Why don't you actually try the suggestions you've been given, and if they don't work for whatever reason you can come back here for troubleshooting tips, but it's not helping anyone if you just say you're confused without trying anything.

I mispronounced the sentence, sorry.
I know this, that the plugins can't start your server. I was asking, if I make the start.sh file with all the properties, why do I need rustserver.cfg? and it will load the cfgs (like rustserver.cfg and server.cfg)? or do I need something to load them? 
I mean, I will start the server with ./start.sh instead of ./rustserver start , right? It will take all the settings from both cfgs? 
That's also for me to know what I need to edit in the future (so I don't edit for nothing)

Sorry again and thank you for your help!

The .sh example is for starting a basic/vanilla rustserver installation WITHOUT LGSM. You don't need it.

rustserver.cfg is specifically used by LGSM. The solution I've given you is for LGSM.

htmlSh3wbejUsbb.png JimDeadlock

The .sh example is for starting a basic/vanilla rustserver installation WITHOUT LGSM. You don't need it.

rustserver.cfg is specifically used by LGSM. The solution I've given you is for LGSM.

Ok, I got it! Thank you!

Now, I paste the command 

0 */6 * * * ~/rustserver r​

I'm assuming that /6 is 6 hours? and what about that 0? 

Thank you for your help

I would still set up a watch dog of sorts, as a timed restart isn't going to handle any crashes or unexpected shutdowns.

Locked automatically