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).   What should the script.h file have inside it? Please show screenshot of output if possible ,what is the answer?

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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).

 

What should the script.h file have inside it? Please show screenshot of output if possible ,what is the answer?

SAMPLE OUTPUT (user input shown in bold):
$ . /minor2.sh
Wed Feb 13 01:05:25 CST 2019 ) initial users logged in
> xyz0123 logged in to cse01
> abc0456 logged in to cse01
> def0789 logged in to cse01
> mat0299 logged in to cse01
> mn0012 logged in to cse01
> rst0034 logged in to cse01
> jkl0056 logged in to cse01
> uv0078 logged in to cse01
# of users: 8
Wed Feb 13 01:05:25 CST 2019 )
Wed Feb 13 01:05:35 CST 2019 ) # of users: 8
Wed Feb 13 01:05:45 CST 2019 )
Wed Feb 13 01:05:55 CST 2019 ) # of users: 8
Wed Feb 13 01:06:05 CST 2019 ) # of users:
mat0299 logged in to cse01
Wed Feb 13 01:06:15 CST 2019 ) # of users: 9
Wed Feb 13 01:06:25 CST 2019 ) # of users: 9
> mat0299 logged in to cse01
# of users: 8
8
> mn0012 logged out of cse01
Wed Feb 13 01:06:35 CST 2019 ) # of users:
Wed Feb 13 01:06: 45 CST 2019 ) # of users: 9
^C (SIGINT) ignored. enter ^C 1 more time to terminate program.
Wed Feb 13 01:06:52 CST 2019 ) # of users: 9
9
Transcribed Image Text:SAMPLE OUTPUT (user input shown in bold): $ . /minor2.sh Wed Feb 13 01:05:25 CST 2019 ) initial users logged in > xyz0123 logged in to cse01 > abc0456 logged in to cse01 > def0789 logged in to cse01 > mat0299 logged in to cse01 > mn0012 logged in to cse01 > rst0034 logged in to cse01 > jkl0056 logged in to cse01 > uv0078 logged in to cse01 # of users: 8 Wed Feb 13 01:05:25 CST 2019 ) Wed Feb 13 01:05:35 CST 2019 ) # of users: 8 Wed Feb 13 01:05:45 CST 2019 ) Wed Feb 13 01:05:55 CST 2019 ) # of users: 8 Wed Feb 13 01:06:05 CST 2019 ) # of users: mat0299 logged in to cse01 Wed Feb 13 01:06:15 CST 2019 ) # of users: 9 Wed Feb 13 01:06:25 CST 2019 ) # of users: 9 > mat0299 logged in to cse01 # of users: 8 8 > mn0012 logged out of cse01 Wed Feb 13 01:06:35 CST 2019 ) # of users: Wed Feb 13 01:06: 45 CST 2019 ) # of users: 9 ^C (SIGINT) ignored. enter ^C 1 more time to terminate program. Wed Feb 13 01:06:52 CST 2019 ) # of users: 9 9
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education