Pfiew that was a long question...
So, during bootup, I am starting on the background a python script (it gets called in the launcher).
sh /home/pi/launcher.sh&
When I ssh to the rpi I can see the python running "top -d 1". That python script runs forever and it outputs some print() messages which of course I can't see when I ssh because the app is in the background. To overcome this, I have to pkill python and then run the script "my-self" on my shell...
To put it in the background again I can either kill the app and restart the rpi or run it myself with the & in the end and then simply exit the shell...
The question is, is there a way to grab that proc from the background, without killing it (we can stop/pause it), and then after I finish looking at it and the messages it prints, send it back to the background and close my shell?
Edited: To put this in perspective, we are talking about industrial environment(s) with 20+ devices per customer. The python script is made by me and in those 4k lines of code I have various print() messages. Ofc those by them selves don't spamm the screen, but, in one certain setup of those devices there is serial communications between my devices and the big machine they "sit" on. That machine is sending serial data every 1-2 seconds, which I print() and also based on those data I do stuff. Normally I don't "care" that much about that serial data, but if there is a problem I need to "see" them "live". There were alot of suggestions and thank you for that. Since I am afraid to write to much stuff on the sd card over and over again, I could always use the "ramdrives" I have in my fstab and create the files there. I mainly use those "ramdrives" because my image is readonly and some "stuff" like samba need to be able to write somewhere.
Edit2: I am currently exploring "import logging" and writing that file to the aforementioned ramdrives. Tried changing the stdout but failed miserably. I believe because I have many threads running and also it doesn't seem like a good practice based on the comments. f = open('output.txt','w') sys.stdout = f