0

I want to achieve the following scenarios:

  1. Connect to remote machine via SSH
  2. Run command on remote machine - that usually takes 3 days to complete and shows output while working
  3. Leave the SSH connection without killing that command terminal process
  4. Connect to remote machine from other machine and see the running output of command.
Shan Khan
  • 1,241
  • 1st thing that comes to mind is a detached Screen. Am I understanding? – EODCraft Staff May 16 '19 at 09:31
  • @EODCraftStaff can we detach screen from one console and connect the screen from other machine ? – Shan Khan May 16 '19 at 10:23
  • @Jos "Connect to remote machine from other machine and see the running output of command." - do you think its possible? – Shan Khan May 16 '19 at 10:25
  • In the first session, you would need to redirect STDOUT output to a file. In the next session, you would do tail -f filename to see the running output. – Jos May 16 '19 at 10:27
  • @Jos can you post an example for this so i can see. the process will be constantly writing output to console that runs via ssh – Shan Khan May 16 '19 at 10:45

1 Answers1

1

First session:

command >> logfile &

Executes command in the background and redirects STDOUT output to a file. Watch the output:

tail -f logfile

Press Ctrl+C to stop viewing the output (not the process itself).

Detach the process from the current session and exit:

disown
exit

Second session:

See the current output of the (still running) process:

tail -f logfile
Jos
  • 29,224
  • actually i want to shutdown the host computer from which i started the SSH command on VM and connect to same VM command line instance from other machine ? Will this answer work on other machine? – Shan Khan May 21 '19 at 07:35