Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a persistent process via ssh

Tags:

I'm trying to start a test server via ssh but it always dies once i disconnect from ssh.

Is there a way to start a process (run the server) so it doesn't die upon the end of my ssh session?

like image 293
9-bits Avatar asked Feb 11 '12 02:02

9-bits


People also ask

How do I keep a process running in the background in Linux?

Keep Linux Processes Running After Exiting Terminal We will use disown command, it is used after the a process has been launched and put in the background, it's work is to remove a shell job from the shell's active list jobs, therefore you will not use fg , bg commands on that particular job anymore.

Which command is used to keep a process running even after logout from shell?

When you want a process to continue running even after you log off a Linux system, you have a couple options. One of them is to use the disown command. It tells your shell to refrain from sending a HUP (hangup) signal to the process when you log off. So, the process continues running.


1 Answers

As an alternative to nohup, you could run your remote application inside a terminal multiplexor, such as GNU screen or tmux.

Using these tools makes it easy to reconnect to a session from another host, which means that you can kick a long build or download off before you leave work and check on its status when you get home. For instance. I find this particularly useful when doing development work on servers that are very remote (in a different country) with unreliable connectivity between me and them, if the connection drops, I can simply reconnect and carry on without losing any state.

like image 193
Johnsyweb Avatar answered Sep 18 '22 20:09

Johnsyweb