Answered step by step
Verified Expert Solution
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 digits always start with or
the number of months is to 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
PART : 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:
#binbash
COUNT
for ; ;
do
COUNTexpr $COUNT #Notice the backtick does command substitution
echo The current loop count is : $COUNT
echo CRTLC to stop! #Notice single verses double quotes
done
make the script executable with the chmod command
copy the script to looper using the cp command
execute the above scripts individually and watch them run example: looper
rerun them a second time and CRTLC and CRTLZ during their execution
use the ps command to see their status: ps u would be my choice, what is yours?
TO HAND IN: Take a screen shot for PART
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
kill the processes that are no longer running Stopped or Zombied using the kill command
notice the Process states: Process.States.PNGDownload Process.States.PNG
PART : 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 CRTLZ 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 commands in your history for PART
change the priority level of a process
run your looper script in the background and note the NICE and PRI levels using the ps l command
issue a renice PID and notice the results
start a process with nice n with your command maybe a looper script notice the results
clean up all of your Zombied and Stopped processes
PART : Practice using redirection and pipes:
Develop a single command line using grouping, pipes and redirection to store records in a file named noofmyprocesses 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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started