You are on page 1of 9

RED HAT SYSTEM ADMINISTRATION I

7.6. Practice: Killing Processes


Document Version: 2015-12-28

Copyright © 2015 Network Development Group, Inc.


www.netdevgroup.com

NETLAB Academy Edition, NETLAB Professional Edition, and NETLAB+ are registered trademarks of Network Development Group, Inc.

“Red Hat,” Red Hat Linux, and the Red Hat “Shadowman” logo are trademarks or registered trademarks of Red Hat, Inc. in the US
and other countries.
7.6. Practice: Killing Processes

Contents
Introduction ........................................................................................................................ 3
Outcomes ............................................................................................................................ 3
Lab Topology ....................................................................................................................... 4
Lab Settings ......................................................................................................................... 5
1 Guided Exercise........................................................................................................... 6

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 2


7.6. Practice: Killing Processes

Introduction

In this lab, students will use keyboard sequences and signals to manage and stop
processes.

Outcomes

This practice exercise will provide experience with observing the results of starting and
stopping multiple shell processes.

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 3


7.6. Practice: Killing Processes

Lab Topology

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 4


7.6. Practice: Killing Processes

Lab Settings

The information in the table below will be needed in order to complete the lab. The
task sections below provide details on the use of this information.

Virtual Machine IP Address Account Password


(if needed) (if needed)

Server1 Machine 172.25.1.11 student student

Desktop1 Machine 172.25.1.10 student student

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 5


7.6. Practice: Killing Processes

1 Guided Exercise

Before you begin...

Access the graphical login screen of the Server virtual machine and log in as student.

The topology includes two virtual machines that are accessible to users. Take care to
perform the tasks as instructed, including using the appropriate virtual machine as
directed.

1. Open two terminal windows, side by side, to be referred to as left and right.

2. In the left window, start three processes that append text to an output file at
one-second intervals. To properly background each process, the complete
command set must be contained in parentheses and ended with an ampersand.

[student@server1 ~]$ (while true; do echo -n "game " >> ~/outfile; sleep 1;
done) &
[student@server1 ~]$ (while true; do echo -n "set " >> ~/outfile; sleep 1;
done) &
[student@server1 ~]$ (while true; do echo -n "match " >> ~/outfile; sleep 1;
done) &

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 6


7.6. Practice: Killing Processes

3. In the right window, use tail to confirm that all three processes are appending
to the file. In the left window, view jobs to see all three processes "Running".

[student@server1 ~]$ tail -f ~/outfile


[student@server1 ~]$ jobs

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 7


7.6. Practice: Killing Processes

4. Suspend the "game" process using signals. Confirm that the "game" process is
"Stopped". In the right window, confirm that "game" output is no longer active.

[student@server1 ~]$ kill -SIGSTOP %number


[student@server1 ~]$ jobs

5. Terminate the "set" process using signals. Confirm that the "set" process has
disappeared. In the right window, confirm that "set" output is no longer active.

[student@server1 ~]$ kill -SIGTERM %number


[student@server1 ~]$ jobs

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 8


7.6. Practice: Killing Processes

6. Resume the "game" process using signals. Confirm that the "game" process is
"Running". In the right window, confirm that "game" output is again active.

[student@server1 ~]$ kill -SIGCONT %number


[student@server1 ~]$ jobs

7. Terminate the remaining two jobs. Confirm that no jobs remain and that output
has stopped. From the left window, terminate the right window's tail
command.

[student@server1 ~]$ kill –SIGTERM %number


[student@server1 ~]$ kill –SIGTERM %number
[student@server1 ~]$ jobs
[student@server1 ~]$ pkill –SIGTERM tail

8. Close your sessions with the bash shell.

12/28/2015 Copyright © 2015 Network Development Group, Inc. www.netdevgroup.com Page 9

You might also like