Saturday, March 26, 2016

Keeping Ubuntu background process running after exit of ssh

At times you launch a process on ubuntu/linux e.g starting a server from your putty and the moment that you close the terminal you see that the process is killed , server down. 

I just had this on an Amazon EC2 linux instance tried a number of things like adding "&" at the end of the command which I was told would work without fail ...but turns out it didn't.

What did work was this solution from askubuntu that worked liked a charm, so am sharing it such as it can help others :

http://askubuntu.com/questions/8653/how-to-keep-processes-running-after-ending-ssh-session

  • ssh into the remote machine
  • start tmux by typing tmux into the shell
  • start the process you want inside the started tmux session
  • leave/detach the tmux session by typing Ctrl+B and then D