1

I connect to my server via ssh that has erlang and cowboy installed on it for running my webpage.

ssh root@my.ip.adress

I then start up my webapp by doing;

./_rel/web_server_example/bin/web_server_example console

Which leaves me at a final line containing;

(web_server_example@127.0.0.1)1> 

the erlang prompt. Now I need both the server and my home computer that is connected to it, because if I close the terminal it stops the erlang program on the server. How can I keep the program running and have my home computer off?

RiaanV
  • 103
  • 9
Jason Basanese
  • 425
  • 2
  • 5
  • 14
  • // , If you have time, and you're going to use this server for a long time, I recommend that you find out the "prototypical" way to do things for your server family or corporation. This will save a lot of time in the long run, if you come across a head-scratcher of a problem on this server in the future. – Nathan Basanese Dec 30 '15 at 21:07

1 Answers1

6

You have (at least) 2 options:

1) Use nohup. Command:

nohup ./_rel/web_server_example/bin/web_server_example console &

then you can exit your ssh session. The output of your process will be redirected to file nohup.out

2) Use GNU screen. You will likely need to install it first: apt-get install screen. Then:

screen bash
./_rel/web_server_example/bin/web_server_example console
<Ctrl-A> D

At this stage you will have a screen session running in the background. You can exit your ssh session. The beauty of the screen way of doing things is that you can re-attach later. Log on to that server and type in command screen -r. You will back to your web_server_example command and you can do things like pressing to interrupt it or interract with it in some other way.

sмurf
  • 4,660
  • 1
  • 23
  • 29