Using A 0.5 Server With Screen: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with 'You finally have your brand new dedicated server, you upload the MTA server with ftp, you configure your config file and start the server. Image:05-ssh-normal.jpg But then…')
 
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
You finally have your brand new dedicated server, you upload the MTA server with ftp, you configure your config file and start the server.  
{{MTA0.5 page}}
You finally have your brand new dedicated server, you upload the MTA server with FTP, you configure your config file and start the server.  


[[Image:05-ssh-normal.jpg]]
[[Image:05-ssh-normal.jpg]]


But then : disaster. When you close your ssh connection the server drops dead.
But then, disaster strikes. When you close your SSH connection, the server drops dead.


Well, at least you have gotten this far. Congratulations. The server closes when you close your session because the server is running on your current terminal. When your session closes the terminal closes and terminates the server. There are 2 ways to get passed this problem.
Well, at least you have gotten this far. Congratulations. The server closes when you close your session because the server is running on your current terminal. When your session closes the terminal closes and terminates the server. There are 2 ways to work around this problem.


== Starting the server in background mode ==
== Starting the server in background mode ==


Most command line programs have a small build-in help system that allows you to see options. You can see these by using the -? swith. For MTA that would be
Most command line programs have a small built-in help system that allows you to see options. You can see these by using the -? swith. For MTA that would be


<pre> ./MTAServer -? </pre>
<pre> ./MTAServer -? </pre>
Line 17: Line 18:
[[Image:05-SSH-Help.jpg]]
[[Image:05-SSH-Help.jpg]]


We need to run our server in the background so:
We need to run our server in the background, so:


[[Image:05-SSH-background.jpg]]
[[Image:05-SSH-background.jpg]]
Line 25: Line 26:
[[Image:05-SSH-kill.jpg]]
[[Image:05-SSH-kill.jpg]]


There we go, up to method number 2
There we go!
 
Now method number 2:


==Using screen==
==Using screen==


A remote linux terminal supports multiple vitual screens. This to stop the user from creating multiple sessions. This is done by the "screen" command. For more information :  
A remote Linux terminal supports multiple virtual screens. This is to stop the user from creating multiple sessions. This is done by the "screen" command. For more information:  


<pre>man screen</pre>
<pre>man screen</pre>


We first need to start a virtual screen, therefore we type in "screen". At first glance it will look like the screen has just cleared. But it has not. Now you can start the server and close the terminal.
We first need to start a virtual screen, therefore we type in "screen". At first glance it will look like the screen has just cleared, but it hasn't. Now you can start the server and close the terminal.


[[Image:05-SSH-screen.jpg]]
[[Image:05-SSH-screen.jpg]]
Line 47: Line 50:
[[Image:05-SSH-creen2.jpg]]
[[Image:05-SSH-creen2.jpg]]


If you have more then one screen running the command ''screen -r'' will bring up a list of all running screens. Every line starts with a pid (or process ID) for the running script.To know what scripts goes with what you can use <pre>ps x</pre>. To bring up the screen use <pre>screen -r pid</pre> where pid is the corresponding process ID.
If you have more then one screen running the command ''screen -r'' will bring up a list of all running screens. Every line starts with a pid (or process ID) for the running script. To know what scripts goes with what, you can use <pre>ps x</pre>. To bring up the screen use <pre>screen -r pid</pre> where pid is the corresponding process ID.


== Links ==
== Links ==
Line 55: Line 58:
[http://www.gnu.org/software/screen/ Screen on GNU.org]
[http://www.gnu.org/software/screen/ Screen on GNU.org]


[[es:Using A 0.5 Server With Screen_ES]]
[[Category:MTA 0.5]] [[Category:Historical]]

Latest revision as of 14:15, 20 June 2012

You finally have your brand new dedicated server, you upload the MTA server with FTP, you configure your config file and start the server.

05-ssh-normal.jpg

But then, disaster strikes. When you close your SSH connection, the server drops dead.

Well, at least you have gotten this far. Congratulations. The server closes when you close your session because the server is running on your current terminal. When your session closes the terminal closes and terminates the server. There are 2 ways to work around this problem.

Starting the server in background mode

Most command line programs have a small built-in help system that allows you to see options. You can see these by using the -? swith. For MTA that would be

 ./MTAServer -? 

The output will look like:

05-SSH-Help.jpg

We need to run our server in the background, so:

05-SSH-background.jpg

There we go, our server is running in the background. But what if we need to stop it? Well, we would first need to find the process ID number, after that we use the kill command to stop it:

05-SSH-kill.jpg

There we go!

Now method number 2:

Using screen

A remote Linux terminal supports multiple virtual screens. This is to stop the user from creating multiple sessions. This is done by the "screen" command. For more information:

man screen

We first need to start a virtual screen, therefore we type in "screen". At first glance it will look like the screen has just cleared, but it hasn't. Now you can start the server and close the terminal.

05-SSH-screen.jpg

When you come back and log in again you can see that the server is still running on a different terminal:

05-SSH-screen3.jpg

with the command

screen -r

you can bring back your server and look at the output:

05-SSH-creen2.jpg

If you have more then one screen running the command screen -r will bring up a list of all running screens. Every line starts with a pid (or process ID) for the running script. To know what scripts goes with what, you can use

ps x

. To bring up the screen use

screen -r pid

where pid is the corresponding process ID.

Links

Putty
Screen FAQ
Screen on GNU.org