0

Say you have a script that takes a while to do something, but then later requires some user input e.g. something like:

#!/usr/bin/python -u
import time
x=0
while(x<10):
    time.sleep(1)
    x+=1
    print(x)
print(input())

and you wanted to run this process in the background and then later recall it in another terminal window, perhaps using

./script.py > output.txt & disown

This process is no longer listed under jobs, but you can see it is still running with pgrep script.py (because you disowned it). Thus you can't recall this job with fg . Is there a way to re-own the process and/or bring it to the foreground in another terminal window? This would be particularly useful when you are controlling the machine remotely with ssh and are worried about an unstable connection.

0 Answers0