0% found this document useful (0 votes)
10 views3 pages

Manage Processes with Bash Script

This document outlines a 10-minute exercise focused on managing processes in a Linux environment. It includes steps for creating a script that appends arguments to a file, starting multiple instances of the script, and using signals to suspend and terminate processes. The exercise emphasizes verifying process states and output to ensure proper execution of commands.

Uploaded by

idrissfafa2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Manage Processes with Bash Script

This document outlines a 10-minute exercise focused on managing processes in a Linux environment. It includes steps for creating a script that appends arguments to a file, starting multiple instances of the script, and using signals to suspend and terminate processes. The exercise emphasizes verifying process states and output to ensure proper execution of commands.

Uploaded by

idrissfafa2
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Exercise (10 Minutes)

Kill Processes

1. Create the /home/student/bin directory.

2. Create the output script file in the /home/student/bin


directory. Press the i key to enter Vim interactive mode. The
file must have the following content as shown. Use the :wq
command to save the file.

#!/bin/bash
while true; do
echo -n "$@ " >> ~/outfile
sleep 5
done

3. Make the output script file executable.

4. Start three processes with the output script file, by


passing the network, interface, and connection arguments.
Start the processes in the background. (Use & to start
process in background)
5. Open another terminal shell, verify that all three processes
are appending content to the /home/student/outfile file.

6. In the first terminal shell, list existing jobs.

7. Use signals to suspend the instance & network process.


Verify that the instance & network process is set to
Stopped. Verify that the network process is no longer
appending content to the ~/outfile file. (Use SIGSTOP signal
to suspend processes)

8. Terminate the instance & interface process. Verify that


the instance & interface process disappeared. Verify that
the instance & interface process output is no longer
appended to the ~/outfile file. (Use SIGTERM signal to
suspend processes)

9. Terminate all the remaining jobs. Verify that no jobs


remain and that output is stopped.

You might also like