1

I know it is possible to have remote VNC screen on server and connect to it and see, what is happening there.

Is it possible to have the same in text-mode shell?

I would connect to remote machine with ssh, then connect to such "remote screen" and see, what my program does there?

The general task is following:

I have python script, that is scrapping the web. This script just prints what it does to stdout. Currently I am running the script in ssh terminal. From time to time I am switching to ssh window and see, how my script feels: either it is still working, or it is crashed with error report.

But in this situation, if I reboot my machine or network disconnect, my ssh session will quit and all containin programs will stop.

How to avoid this? How to have something like text-mode VNC?

2

Look for screen program. It should do what you want.

Alternatively you can run your program with nohup so it will not die when you disconnect your session (later on you can see the output in nohup.out file)

  • Even I guessed it's name :) – Dims Jun 20 '17 at 13:39
  • This answer should probably also mention tmux which is somewhat more versatile and modern. – tripleee Jun 20 '17 at 18:21
  • IMO nor screen not any other utility are necessary as all the work can be done with sample process management tools like &, nohup and redirects – Romeo Ninov Jun 20 '17 at 18:35
1

You can use few tricks which can help you

  1. Put the script in background with & at the end
  2. Deattach the background script from terminal with nohup command
  3. Redirect the STDOUT and STDERR to files to be able to monitor the progress like

nohup program >stdout.log 2>stderr.log &

So you will be able to monitor the progress as well if problem occur and program crash

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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