Canceling a background job
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:
In the tcsh shell, use:kill -s KILL %7
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:
will kill every process in the process group with PGID 123456.kill -s KILL -- -123456
In the tcsh shell:
will kill every process in the process group with PGID 123456.kill -KILL -123456