Recent Discussions

running a server in the background

Unanswered
Aidi posted this in #questions
Messages23 messages
Views0 views
AidiOP
I'm self-hosting a server for my friends on an old laptop. Currently the way I'm turning the server on and off is by sshing onto it and running a shell script, but this means that if I close the terminal window that I ran the script on the server dies. Is there a way to make the server run even if I close the terminal window?
AidiOP
Preferably I'd like to still be able to access the console to run commands on the server after closing and reopening it, but from my understanding that is probably not how Shell scripts work.
Bluetick Coonhound
screen
screen -mS minecraft

Then start your server in there
@Bluetick Coonhound screen -mS minecraft

Then start your server in there
Isn’t it just screen -S minecraft
what’s the m for
Tree Swallow
I think its so u dont start the screen in a screen
it makes a new detatched session
ah neat
@Tamz Isn’t it just screen -S minecraft
AidiOP
Wouldn't shutting down my laptop still close the screen though
AidiOP
doesn't that mean that the server would die if I turned off my laptop
wait do you mean I run screen on the lapop I'm using to ssh into the server or on the server itself
@Aidi doesn't that mean that the server would die if I turned off my laptop
Are you looking for a solution to keep your laptop off but somehow run a server while the computer is off?
Screen makes another terminal, which in your case is another SSH. you run the command and get thrown into an identical environment, where you can do whatever you want you can launch your server and then you can return back to the main SSH terminal
There is no limit on screens so go ham
AidiOP
this is what I mean
- I am running a server on Laptop #1. Laptop #1 is on at all times.
- I am currently starting the server by sshing in from Laptop #2. Laptop #2 is not always on at all times.
- I want a way to be able to keep the server is on while Laptop #2 is off.
laptop 1 runs screen
laptop 1 keeps screen online even if you disconnect
laptop 2 can be off
Bluetick Coonhound
Screen is still the solution ^
Or tmux, or bundle your server in docker and run it detached, either way works
Tree Swallow
Tmux my beloved
AidiOP
I'll try screen then. Will update when I get it working!
Loading...