Question: SCRIPT DESCRIPTION: Write a complete bash script that monitors the number of processes per user on the current CSE Linux machine (e.g., cse01, cse02, etc.)

 SCRIPT DESCRIPTION: Write a complete bash script that monitors the number
of processes per user on the current CSE Linux machine (e.g., cse01,

SCRIPT DESCRIPTION: Write a complete bash script that monitors the number of processes per user on the current CSE Linux machine (e.g., cse01, cse02, etc.) where the script is running. In particular, you will count all processes and total them per user every 5 seconds and report each user ID with the number of processes running during that time frame. Note this will include system processes. If the user enters a list of user IDs as arguments to the program it should only report processes for those users. In addition, you will install a custom signal handler to trap the SIGINT (.e., C). This signal handler should prompt the user if they really want to exit. If they enter "Y" or "Y", your program should exit. If anything else is entered, the program should continue to run. You will also print out the current date and time, a heading before listing the users and process count followed by a line containing the total number of users and total number of processes running. The users column and the counts should line up to look nice. Add a blank line between each output to make it easier to see each report. The output of each line Please see the SAMPLE OUTPUT for several examples, including the different scenarios that might occur. REQUIREMENTS: Your script should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. Your bash script should be named "minor2.sh", without the quotes. Note that this must be done as a bash script, not a C program. Your script will be graded based largely on whether it works correctly on the CSE machines (e.g., cse01, cse02, ..., cse06), so you should make sure that your script runs on a CSE machine. Please pay attention to the SAMPLE OUTPUT for how this script is expected to work. If you have any questions about this, please contact your instructor or TAS assigned to this course to ensure you understand these directions. 8 SAMPLE OUTPUT (user input shown in bold): $ ./minor2.sh root uuidd WDJO017 Sun 7 Feb 2021 11:19:06 PM CST User ID Count root 92 wdj 0017 8 uuidd 1 3 USERS, TOTAL PROCESSES 101 Sun 7 Feb 2021 11:19:11 PM CST User ID Count root 92 wdj0017 uuidd 1 3 USERS, TOTAL PROCESSES 101 AC (SIGINT) received Terminate Program? (Y/N) n Continuing Execution Sun 7 Feb 2021 11:19:16 PM CST User ID Count root 90 wd; 0017 uuidd 3 USERS, TOTAL PROCESSES 99 Sun 7 Feb 2021 11:19:21 PM CST User ID Count root 90 wdj0017 uuidd 3 USERS, TOTAL PROCESSES 99 AC (SIGINT) received Terminate Program? (Y/N) Y Terminating program 8 1 8 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!