Module 125 stop (csh, ksh)

Previous Table of Contents Next


Module 125
stop (csh, ksh)

DESCRIPTION

The internal stop command stops the execution of a background job. If you have a job running in background and type stop , the current background job is stopped (placed in a suspended state). You can then kill the job, bring it into foreground, or place it in background again.


Korn Shell
The ksh does not implement stop as an internal command. You have to create an alias to perform the function. Simply place the following line in your profile.
alias stop="kill-STOP"

COMMAND FORMAT

Following is the general format of the stop command.

 top [ %job ... ]      kill -STOP [ %job ... ] 

The ksh only supports the second format. But you can set up an alias named stop to perform the kill command.

Arguments

The following arguments may be passed to the stop command.

%job A job number associated with a process. If the interactive option is turned on, job may be one of the following:
% num A job number associated with a process.
% string The job whose name begins with string .
%? string The job whose name contains string .
%+
%% Current process, the last process you suspended.
%- Previous process, the process suspended before the current job.
The current background job is affected if you do not specify a job number. The current background job is the last job placed in background.

RELATED COMMANDS

Refer to the bg , fg , jobs , kill , and suspend commands described in modules 9, 51, 68, 70, and 129.

APPLICATIONS

The stop command can be used to stop the execution of a job you have placed in background, thus allowing you to control whether a job should continue to run. Once you have stopped a job you can return it to background for execution, bring it into the foreground for interactive execution, or terminate it with the kill command.

TYPICAL OPERATION

In this activity you use the stop command to stop a job you have placed in background mode. Begin at the shell prompt.

1.    Type ls -R / > /dev/null & and press Return . This places a recursive ls in background.
2.    Type stop %1 and press Return . The ls command you just started is stopped.
 cj> stop %1    [1] + Stopped               ls -R > /dev/null 
3.    Type jobs and press Return to display the stopped job.
4.    Type kill %1 and press Return to kill the ls command.
 cj> kill %1    [1] Terminated              ls -R > /dev/null 
5.     Turn to Module 70 to continue the learning sequence.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

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