"There are stopped jobs" – a follow up

“There are stopped jobs” – what does this message mean?

Here’s something I’ve not been able to find in the mailing list archives.

running 2.2.7 RELEASE.  I had three telnet sessions going.  All were su’d. 
I did an exit on one.  I got a message "There are stopped jobs".  I
tried the same thing on telnet session #2, got the same message.   On telnet #3, I
did an exit, then another to logout.  The other telnet sessions would then
close.  What was going on?

I suspect I had started a process by pressing CONTROL-Z.  This sounds vaguely
familiar to me.  I was running ipmon to test the logging as part of my IP Filter work.

I was running the bash shell (Changing the shell).  See
the "JOB CONTROL" section of man bash for more information.  Here is an

If an attempt to exit bash is made while jobs are stopped, the shell prints a
warning message. The jobs command may then be used to inspect their status. If a second
attempt to exit is made without an intervening command, the shell does not print another
warning, and the stopped jobs are terminated.

If you type exit twice in a row, or type jobs and then exit,
the shell will not warn you about any stopped jobs.  I now think that I typed exit
twice in my scenario described at the start of this article.

bg and fg – 31 December 1998

Laz on undernet #freebsd mentioned that I should do a "man fg".
  On about the 6th page, you will find a section titled Jobs.  
Read this section.  It contains interesting facts about how to take a job to and from
the background.  I’ve reproduced some of that section below:

  The shell associates a job with each pipeline.  It keeps a table of 
  current jobs, printed by the jobs command, and assigns them small 
  integer numbers.  When a job is started asynchronously with `&', the
  shell prints a line that looks like:

        [1] 1234

  showing that the job which was started asynchronously was job 
  number 1 and had one (top-level) process, whose process id was 1234.

  If you are running a job and wish to do something else you may hit 
  the key ^Z (control-Z) which sends a STOP signal to the current job.
  The shell will then normally show that the job has been `Stopped', 
  and print another prompt.  You can then manipulate the state of this
  job, putting it in the background with the bg command, or run some 
  other commands and eventually bring the job back into the 
  foreground with the foreground command fg. A ^Z takes effect 
  immediately and is like an interrupt in that pending output and 
  unread input are discarded when it is typed. There is another 
  special key ^Y that does not generate a STOP signal until a 
  program attempts to read(2) it.  This request can usefully be 
  typed ahead when you have prepared some commands for a job that 
  you wish to stop after it has read them.

Leave a Comment

Scroll to Top