Checking Job Status

   

Korn Shell: Unix and Linux Programming Manual, Third Edition, The
By Anatole Olczak

Table of Contents
Chapter 5.  Job Control


The status and other information about all jobs is displayed using the jobs command. The following jobs output shows that there is one stopped job, and two running jobs. The + indicates the current job, and ?/span> indicates the previous job:

 $ jobs  [3]  + Stopped            split ?000 hugefile  [2]  ?Running            find /  name core  print &  [1]    Running            sleep 25 & 

The jobs l command shows the same information, along with the process ids, while jobs p only gives you the process ids.

 $ jobs  l  [3]  + 466 Stopped split ?000 hugefile  [2]  ?465 Running find /  name core  print &  [1]    463 Running sleep 25 & 

Killing Jobs

Stopped or background jobs are terminated with the kill command. Unlike bg or fg, a job argument must be given. Here, a sleep command is put in the background, then killed:

 $ sleep 100 &  [1]   254  $ kill %1 

It could also be given as kill 254.

Waiting for Jobs

You can make the Korn shell wait for some or all background jobs to complete with the wait command. If no argument is given, the Korn shell waits for all background jobs to complete.


       
    Top
     



    Korn Shell. Unix and Linux Programming Manual, Third Edition
    Korn Shell. Unix and Linux Programming Manual, Third Edition
    ISBN: N/A
    EAN: N/A
    Year: 2000
    Pages: 177

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net