Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Enter the following scrpit: SEE ATTACHED PHOTO Test the script. Make the following improvements to the script: Validate inputs ( from reads ) to make

Enter the following scrpit: SEE ATTACHED PHOTO
Test the script.
Make the following improvements to the script:
Validate inputs (from reads) to make sure that valid input was entered. If invalid input was entered, give them a message and ask them to enter it again. Considerations include:
allow user to enter a "y" or "Yes" or "YES" or other valid answers to run the script (pretest loop sentinel)
the year of birth in 4 digits always start with 19 or 20
the number of months is 1 to 12 only
Change the script to allow the user to use long names for months
Add the number of days in age (so you report the number of years, months, and days of age) to the script
TO HAND IN: Take a screen shot of your entire script and a sample run for PART 1
PART 2: Experiment with managing processes using the process status command, including starting and stopping processes:
test the following commands and review their results
ps
ps -u
ps f
ps ef
ps l
ps ax
ps f
ps u
notice all of the fields with the different switches but specifically the PPID and PID. What are the differences between the different options?
create the following script using vi named looper:
#!/bin/bash
COUNT=0
for (( ; ; ))
do
COUNT=`expr $COUNT +1` #Notice the backtick does command substitution
echo The current loop count is : $COUNT
echo ' CRTL-C to stop!' #Notice single verses double quotes
done
4. make the script executable with the chmod command
5. copy the script to looper2 using the cp command
6. execute the above 2 scripts individually and watch them run (example: ./looper )
7. rerun them a second time and CRTL/C and CRTL/Z during their execution
8. use the ps command to see their status: ps u would be my choice, what is yours?
9. TO HAND IN: Take a screen shot for PART 2
10. review the processes utilizing the top command, utilize some of the interactive commands for top,
notice which processes are getting the most system resources (CPU & memory)
11. kill the processes that are no longer running (Stopped or Zombied) using the kill -9 command
notice the Process states: Process.States.PNGDownload Process.States.PNG
PART 3: Experiment with starting processes in the background, managing those processes, and changing the priority:
remove the echo commands from the looper script
start this script in the background by using the & (example: ./looper & )
use the jobs (note the job ID with the jobs command) and ps
move it to the foreground using the fg command followed by the job number, use CRTL/Z to stop it and return it to the background using the bg command and then kill the process.
TO HAND IN: Take a screen shot of the last 10 commands in your history for PART 3
change the priority level of a process
run your looper2 script in the background and note the NICE and PRI levels using the ps l command
issue a renice +15 PID and notice the results
start a process with nice n 19 with your command (maybe a looper script), notice the results
clean up all of your Zombied and Stopped processes
PART 4: Practice using redirection and pipes:
Develop a single command line using grouping, pipes and redirection to store records in a file (named no_of_my_processes) that contains: date and time; the number of your user processes currently running on the general.
TO HAND IN: Take a screen shot of the last this command line for PART 4
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logics For Databases And Information Systems

Authors: Jan Chomicki ,Gunter Saake

1st Edition

1461375827, 978-1461375821

More Books

Students also viewed these Databases questions

Question

1. Answer the question, What is human resource management?

Answered: 1 week ago

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago