Using A 0.5 Server With Screen: Difference between revisions
No edit summary |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
You finally have your brand new dedicated server, you upload the MTA server with | {{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 | 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 | 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 | 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 | There we go! | ||
Now method number 2: | |||
==Using screen== | ==Using screen== | ||
A remote | 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 | 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] | ||
[[Category:MTA 0.5]] [[Category:Historical]] | [[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.
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:
We need to run our server in the background, so:
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:
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.
When you come back and log in again you can see that the server is still running on a different terminal:
with the command
screen -r
you can bring back your server and look at the output:
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.