[comp.unix.questions] Stopping or foregrounding a background job.

cosc6bp@elroy.uh.edu (A JETSON News User) (02/13/90)

Greetings,

I have a C data gathering program running in the background. It is set up to 
execute a final statistics gathering routine when I bring it into the 
foreground and stop it via Ctrl-C.  It works really well except when I have
to bring it back into the foreground after I have logged out.  How does
one do this?  At that point you can't %number or fg number it into the 
foreground.  All I can get on it is it's process id from ps aux.  Killing
it doesn't seem to work as I have tried putting signal(SIGKILL, handler) in 
the program.  The manual seems to confirm that this won't work.  
It's a system of Sun 3/50 -60's.  So finally:

    . Is there any command to bring the job into the foreground after 
    you have logged out?

    . Is there a signal that I can put into the program that I can stop it
    while still in the background?

    . Any other way to make the program print out the statistics it has 
    gathered to date and stop.

Ignacio Valdes      

khera@juliet.cs.duke.edu (Vick Khera) (02/14/90)

In article <5542.25d6bcab@elroy.uh.edu> cosc6bp@elroy.uh.edu (A JETSON News User) writes:
>I have a C data gathering program running in the background. It is set up to 
>execute a final statistics gathering routine when I bring it into the 
>foreground and stop it via Ctrl-C.  It works really well except when I have
>to bring it back into the foreground after I have logged out.  How does
>one do this?  At that point you can't %number or fg number it into the 
>foreground.  All I can get on it is it's process id from ps aux. 
 [...]
>It's a system of Sun 3/50 -60's.  So finally:
 [...]
>Ignacio Valdes      

I assume you are trapping SIGINT to catch the CTRL-C.  All you need to do
is issue the correct signal to your process, which is easily done with the
kill command. "kill -INT <pid>" should do the trick.

								v.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera                              Department of Computer Science
ARPA:   khera@cs.duke.edu               Duke University
UUCP:   ..!{mcnc,decvax}!duke!khera     Durham, NC 27706