fg help


 
Thread Tools Search this Thread
Operating Systems AIX fg help
# 1  
Old 08-27-2008
fg help

I started a Java process via SSH that I knew was going to take a long time to run so I backgrounded it and let my SSH session expire. I logged back in to check up on it (it prints its output to stdout, and a summary to a log file when it's finished) and tried to pull it in to the foreground but wasn't able to. The fg man page says this:
Quote:
fg [JobID]

The JobID parameter can be a process ID number, or you can use one of the following symbol combinations:...
Code:
fg <PID>

and I got this error:
Quote:
/bin/ksh: fg: 0403-002 The specified job does not exist.
I also tried just plain old fg as it was the last process that I sent to the background and I received the same error. The output of ps -ef | grep java confirms that the PID is in fact correct and that the process is still running. What gives?
# 2  
Old 08-27-2008
You can't foreground it to a different terminal than the one it was started in. Run under screen or similar if you need to disconnect and reconnect.
# 3  
Old 08-27-2008
Oye vey. screen isn't installed on this system. Is there any other way to bring it back or will I just have to wait for it to finish?

On a side note: what's the reasoning behind only being able to fg and bg processes in the current terminal? It seems to me that greatly inhibits their usefulness.
# 4  
Old 08-27-2008
Freely moving processes between different terminals has some fundamental problems because the environment that goes with the process might be specific to a particular terminal type. If you restrict yourself to only input terminals of a certain kind (or back in the olden days, that would have been terminals of a single model from a single manufacturer), you might be able to get it working, but then screen already handles that brilliantly.

Agree that the basic design is a bit unattractive, and ideally, you should have something like screen for X clients, too (some remote desktop tools now make that feasible, too).
# 5  
Old 08-27-2008
OK, thanks for the input.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question