0

Two related questions:

  1. If I ssh into a remote server and start a long running task in the foreground (:~$ ./my-task > out.log), will the process continue to run when my connection to the server ends?

  2. The same long running task from question #1 takes about 5 minutes to run. If I open another terminal window and play around with the file where the output is being sent (tail -f out.log | grep 'Loop count') can that impact the amount of time it'll take my-task to finish?

1

When you kill your connection to your server, the task will end. I use Tmux for this kind of stuff.

You can install it in the normal manner.

sudo apt-get install tmux

The idea is you ssh into your server, then from with your shell start tmux and attached to a tmux virtual console. Start your stuff going from within the tmux virtual console, detach from it then kill your connection to the server.

The tmux virtual console will remain running, and so will all your stuff within that conole. You can connect to your server and attach to / detach from tmux consoles at will.

Tmux has a half decent man page, but here are a few keys to get you going.

tmux ls list running tmux sessions.

tmux attach -t 0 attach to 0.

ctrl-B c create a terminal.

crtl-B d detach a termianl.

ctrl-B " split terminal vertically.

ctrl-B % split terminal horizontally.

arrows navigate panes.

0-9 selects windows.

s switches sessions.

Hope that helps as a starter.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.