csh/jobs funniness

Ed Gould ed at mtxinu.UUCP
Thu Feb 28 09:03:11 AEST 1985


> Under csh if you have a job running in the background, jobs says running
> and ps will give a stat of R indicating runnable. If you send the process
> a signal 17 or 18 (STOP,TSTP) using kill, jobs will indicate the process
> has stopped and ps will indicate T for stopped. So far everything is fine,
> however if you restart the job using using kill -19 pid (or -CONT) the 
> process does restart, ps will give a STAT of R, but jobs will indicate 
> still stopped. This happens on both our VAX and SUN running 4.2bsd.
> Any comments or solutions?
> 
> 					seismo!tiberio

There's no way for the shell to know that the job has been restarted,
unless it did the restart itself.  It knows that it was stopped,
because parents get notified of such events via a wait() call
(or variant).  Usually, it's safer to stop and start processes using
csh's builtins, since they will correctly deal with multiple
processes in a job.

(In case it's not clear how to restart a job in csh, use the "fg"
or "bg" builtins, e.g. "fg %5" to bring job #5 to the foreground.
"Fg" or "bg" without arguments will operate on the "current"
job, noted with a "+" in the output from "jobs".  There are also
synonyms:  "%n" == "fg %n",  "%n&" == "bg %n", etc.)

-- 
Ed Gould		    mt Xinu, 739 Allston Way, Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146



More information about the Comp.bugs.4bsd.ucb-fixes mailing list