The FreeBSD Diary

The FreeBSD Diary (TM) Remember
I remember
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

"There are stopped jobs" - what does this message mean? 9 November 1998
Need more help on this topic? Click here
This article has no comments
Show me similar articles
Here's something I've not been able to find in the mailing list archives.

I'm 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 extract:

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:
Jobs
  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.

Share
Need more help on this topic? Click here
This article has no comments
Show me similar articles