z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Canceling a background job

z/OS UNIX System Services User's Guide
SA23-2279-00

To cancel a background job, use the kill command. To be able to kill a process, you must own it. (The superuser, however, can kill any process except init.)

Before you can cancel a background job, you need to know either a PID, job identifier, or PGID. You can use the jobs command to determine any of these.

The format of the kill command in the z/OS® shell is:
kill [-s signal name] [pid] [job-identifier]
 
The format of the kill command in the tcsh shell is:
kill [-signal name] [pid] [job-identifier]

To kill one process, use its PID.

Example: To kill a process with the PID 717, issue:
kill 717
Any other processes in the job—from a pipe—would not be killed.
To kill a particular process group, you can use a job identifier or a negative PGID.
  • You can use the job identifier for one process in the group preceded with a % to kill every process in the group. In the z/OS shell, use:
    kill -s KILL %7
    In the tcsh shell, use:
    kill -KILL %7
  • You can use a negative PGID to kill every process in a process group. (The PGID is the PID for the first process in the process group.) For example, in the z/OS shell:
    kill -s KILL -- -123456
    will kill every process in the process group with PGID 123456.
    In the tcsh shell:
    kill -KILL -123456
    will kill every process in the process group with PGID 123456.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014