How to suspend and bring a background process to foreground
I have kind of an odd problem which I haven't encountered before. Here's what I did:
I started an application with
No command line arguments, no
& to make it run in background.
Unfortunately, my system froze at some point. No access via the GUI was possible, so I decided to first stop all CPU-intensive tasks. So I brought up a
tty (Shortcut Ctrl + Alt + F2 on Ubuntu) and did
kill -STOP pid, after getting the right
Luckily, after some extra time, the system became unfrozen. So I restarted the process with
kill -CONT pid.
But here's what I see in the terminal:
+ Stopped ./myApp
And now the terminal is in the state as if the application isn't running (i.e. I can do
ls or whatever I like), but the process manager still reports the application to be running. I'm very glad it does, because I would lose 34 hours of computing time (and yes, it's an extremely bad app; not written by me, of course), since there is no output at all to file.
When the heavy task of the application is finished (expectedly in a couple of hours), I need to enter a specific task inside of the application to make it write to file (it is somewhat of a custom shell prompting for input, so I guess
cin is in use).
So the question is: How to bring me back to the application such that I see its output and can interact with it? If not possible: is it possible to stream into the app and initiate the required command without restarting the app?
Update The application does still output to the exact same terminal.
FYI, as you might need it: I'm running Ubuntu x86 with kernel 3.2.0-36