New Server not staying connected 24/7

Post Reply
Mardarth
Member
Posts: 17
Joined: Thu Jun 21, 2018 16:37

New Server not staying connected 24/7

by Mardarth » Post

have my server ready to launch so that friends and family can enjoy the game, but I am having a small problem trying to figure out how to keep the server running 24/7.

It is hosted on Linux Ubuntu

I have tried starting the server via terminal using Putty , server shuts down as soon as I close putty.

WinSCP gives the same problem, shuts down when I shut down my home computer (since putty nor winscp are running with open terminals)

The best solution I have found so far, is leaving telent terminal open on my iPhone. So far, server has stayed online 13 hours with no, but this is only if there are players in the game.

So, I tried leaving one idle player in a game last night, to see if I would wake up and have terminal still running, the terminal times out with an error message about staying idle, so I assume the player should have been moving, and since it just stood in game, the terminal shut down the connection automatically. The terminal was still up and running on my iPhone when this happened.

So now I am totally clueless on how to keep it running 24/7.

Any assistance would be greatly appreciated!

sfan5
Moderator
Posts: 4095
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

Re: New Server not staying connected 24/7

by sfan5 » Post

First, minetestserver does not shut down automatically if there are no players in-game.

What you want to keep the server running in the background is something like tmux.
Create a tmux instance, start your server inside then detach and it will still be running.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: New Server not staying connected 24/7

by Krock » Post

1) Write a script that starts the server with the right arguments (code source)

Code: Select all

#!/bin/bash -x

./minetestserver --gameid minetest --worldname world
2) Set it up as daemon (command source)

Code: Select all

setsid myscript.sh >/path/to/logfile 2>&1 < /dev/null &
3) Consider putting minetestserver inside a forever loop, for the case when it crashes. Also run a command to notify about recent crashes (or when they occur in fast intervals).
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Mardarth
Member
Posts: 17
Joined: Thu Jun 21, 2018 16:37

Re: New Server not staying connected 24/7

by Mardarth » Post

Thank you sfan and Krock!!!

I went with TMUX as it was already installed on my server, and I now have the game running 24 / 7 without having to use my own terminals on comp or phone.

I had never heard of tmux before, so far, this program rocks!

User avatar
Festus1965
Member
Posts: 4181
Joined: Sun Jan 03, 2016 11:58
GitHub: Festus1965
In-game: Festus1965 Thomas Thailand Explorer
Location: Thailand ChiangMai
Contact:

Re: New Server not staying connected 24/7

by Festus1965 » Post

Mardarth wrote: I have tried starting the server via terminal using Putty , server shuts down as soon as I close putty.
!
seams you started the server in a terminal in putty or somehow ...

or the login with putty is then off, closing runnding instances ...

as my minetest-server IS running 24/7 on ubuntu ... in a terminal, that i can see what happens
Human has no future (climate change)
If urgend, you find me in Roblox (as CNXThomas)

Mardarth
Member
Posts: 17
Joined: Thu Jun 21, 2018 16:37

Re: New Server not staying connected 24/7

by Mardarth » Post

Hi Festus, Putty is what I was using, which was closing running instances when I closed putty.

I started the minetest server using TMUX yesterday, and the server has been running fine ever since with no downtime.

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests