How do I keep a Linux process running through SSH?

1142415 pts.
Tags:
Linux
SSH
We're connected to our Linux machine through SSH. I have to run a bash script for our file system operations. We need it running for a while (multiple hours) but we can't leave the SSH open due to connection issues. Is there a way I can keep it running?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Did you try using tmux? Trying using it as it’s superior to screen.

To get the same functionality as explained in the answer recommending screen, you would need to do the following:

  • 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

You can now safely logoff from the remote machine, your process will keep running inside tmux. When you come back again and want to check the status of your process you can use tmux attachto attach to your tmux session.

If you want to have multiple session running side-by-side you should name each session using Ctrl-B and $. You can get a list of the currently running sessions using tmux list-sessions.

tmux can do much more advanced things then handle a single window in a single session.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: