Write a complete bash script that monitors who logs in and logs out of the current CSELinux machine (e.g., cse01, cse02, etc.) where the script is running. In particular, youwill check the status of who is logged in every 10 seconds and report each user ID thatlogs in or logs out during that time frame. Note that there may be more than one userthat logs in or out duringthis interval. You must include the host name when reportingthe user ID information. In addition, you will install a custom signal handler to trap the SIGINT(i.e.,^C) one time before you are able to terminate the script with the SIGINT. You will also print out the current date and time and report the number of users loggedin,even if there are no changes (i.e.,no one logged in or out during the interval).   HOW TO DO THIS? PLEASE EXPLAIN WITH ANSWER!!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a complete bash script that monitors who logs in and logs out of the current CSELinux machine (e.g., cse01, cse02, etc.) where the script is running. In particular, youwill check the status of who is logged in every 10 seconds and report each user ID thatlogs in or logs out during that time frame. Note that there may be more than one userthat logs in or out duringthis interval. You must include the host name when reportingthe user ID information. In addition, you will install a custom signal handler to trap the SIGINT(i.e.,^C) one time before you are able to terminate the script with the SIGINT. You will also print out the current date and time and report the number of users loggedin,even if there are no changes (i.e.,no one logged in or out during the interval).

 

HOW TO DO THIS? PLEASE EXPLAIN WITH ANSWER!!

**Sample Output Explanation (User Input in Bold)**

This output represents the execution of a shell script named `minor2.sh`. It logs user activity on a system, detailing when users log in or out.

### Details:

1. **Execution Start:**
   - `$ ./minor2.sh`
   - The script is executed on a Wednesday, February 13, at 01:05:25 CST 2019. At this point, the system checks for initially logged-in users.

2. **Initial Logged-in Users:**
   - `xyz0123 logged in to cse01`
   - `abc0456 logged in to cse01`
   - The above users are initially logged in on the system.

3. **Subsequent User Logins:**
   - Additional users log into `cse01` in the following sequence:
     - `def0789`
     - `mat0299`
     - `mn0012`
     - `rst0034`
     - `jkl0056`
     - `uv0078`

4. **User Count Monitoring:**
   - The script monitors the number of logged-in users at intervals:
     - From 01:05:25 to 01:06:05, there are consistently 8 users logged in.
     - Following `mat0299` logging in again, the user count increases to 9.

5. **User Logout and Interruption:**
   - `mn0012` logs out of `cse01`, but the number of users remains at 9 during the specified checks.
   - The script handles an interrupt signal (`^C`) twice, which is ignored the first time and acknowledged the second time to terminate the program.

Through this output, we can observe how the script tracks user sessions and manages interrupt signals in a Unix-like environment.
Transcribed Image Text:**Sample Output Explanation (User Input in Bold)** This output represents the execution of a shell script named `minor2.sh`. It logs user activity on a system, detailing when users log in or out. ### Details: 1. **Execution Start:** - `$ ./minor2.sh` - The script is executed on a Wednesday, February 13, at 01:05:25 CST 2019. At this point, the system checks for initially logged-in users. 2. **Initial Logged-in Users:** - `xyz0123 logged in to cse01` - `abc0456 logged in to cse01` - The above users are initially logged in on the system. 3. **Subsequent User Logins:** - Additional users log into `cse01` in the following sequence: - `def0789` - `mat0299` - `mn0012` - `rst0034` - `jkl0056` - `uv0078` 4. **User Count Monitoring:** - The script monitors the number of logged-in users at intervals: - From 01:05:25 to 01:06:05, there are consistently 8 users logged in. - Following `mat0299` logging in again, the user count increases to 9. 5. **User Logout and Interruption:** - `mn0012` logs out of `cse01`, but the number of users remains at 9 during the specified checks. - The script handles an interrupt signal (`^C`) twice, which is ignored the first time and acknowledged the second time to terminate the program. Through this output, we can observe how the script tracks user sessions and manages interrupt signals in a Unix-like environment.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY