Running the server 24/7 without PuTTY
-
- A semi-regular
- Posts: 16
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Sat Nov 21, 2009 7:19 pm
Running the server 24/7 without PuTTY
How do I run a game server 24/7 without having PuTTY on? I can't have my computer online 24/7 and that seems impractical for everyone to do so I'm guessing there's a different way to do this.
Re: Running the server 24/7 without PuTTY
To do this, I recommend using the "screen" utility. Start your server with a command like this:
Where "screenname" is an identifier you want to use for the screen (so that you can reconnect to it later) and "yourcommandline" is the command line that you've been using already to start up your server.
This will start the server, but hide it from view, putting you right back to another command prompt. To connect to the screen session you just created (and see the server's console), just use this command:
To hide the screen session again, hold down the control key and hit "a"; then, let go of both keys and hit "d". You should see the message "[detached]" and be returned to the normal command prompt.
While your screen is detached, you can exit your SSH window and it will continue running on the server.
If you exit the game server (such as with Control-C), the screen session will close.
A few other useful commands to get you going:
Shows a list of running (and detached) screens.
Detach a screen remotely and then reattach it to your session (if you left it attached in a window on a different machine, or your SSH connection was interrupted, this can be very useful to recover it).
Control-a, Escape will let you cursor through the screen buffer while you are attached to a screen. Hitting Escape again will get you back out.
Code: Select all
screen -AmdS screenname yourcommandline
This will start the server, but hide it from view, putting you right back to another command prompt. To connect to the screen session you just created (and see the server's console), just use this command:
Code: Select all
screen -r screenname
While your screen is detached, you can exit your SSH window and it will continue running on the server.
If you exit the game server (such as with Control-C), the screen session will close.
A few other useful commands to get you going:
Code: Select all
screen -ls
Code: Select all
screen -DR screenname
Control-a, Escape will let you cursor through the screen buffer while you are attached to a screen. Hitting Escape again will get you back out.
Re: Running the server 24/7 without PuTTY
Wonderful. Thanks!
Re: Running the server 24/7 without PuTTY
Ah, can't edit my post but I wanted to know why a screen might die? I tried this but I was able to run it but after a while, it showed the screen as being dead:
Code: Select all
There is a screen on:
4419.cs (Dead ???)
Re: Running the server 24/7 without PuTTY
Oh, I set it up last night before the maintenance and I was just able to check it tonight, that might've been the cause but I'm just making sure.
Extremely sorry for the triple post
Extremely sorry for the triple post

Re: Running the server 24/7 without PuTTY
A machine crash will cause dead screens like that; if we weren't able to log in to shut down your server gracefully during a maintenance event (that is, if the password didn't match what was on the Server control page), the virtual machine would think it crashed, and this would happen. To remove them from the list, use this command:
Code: Select all
screen -wipe
-
- This is my homepage
- Posts: 645
- Joined: Sun Sep 20, 2009 6:15 pm
Re: Running the server 24/7 without PuTTY
I tried to do the screen option on my VPS and no such luck. It seems screen isn't installed. I'm running CentOS 5 though, not Gen. I ending up just all my command lines normally, then adding '&' at the end to keep it running.

Re: Running the server 24/7 without PuTTY
I haven't tried it, but you could likely install screen in CentOS with a command like:
Code: Select all
yum install screen
-
- This is my homepage
- Posts: 645
- Joined: Sun Sep 20, 2009 6:15 pm