Write a script called 09-firstLastLogout that will do the following: i. Reads data from a wtmp...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a script called 09-firstLastLogout that will do the following: i. Reads data from a wtmp log file that will be specified on a single command-line parameter. ii. If the file does not exist, is a directory, or there are more or less than one parameters provided, display an appropriate error/usage message and exit gracefully. iii. Finds the first and last person to be on the system during the time period recorded in the wtmp log file specified. The command called last should be used to read the wtmp file and generate the data needed for this report. iv. You may find it helpful to make use of the mktemp command to create a temporary file to process depending on whether the script is run with a filename parameter or not. If you do use mktemp, be sure to remove any temporary files before the script ends. v. Make the output look like that in the examples shown below. I will likely use a different file when I grade the assignments, so it should work no matter what wtmp file is specified. Note that there is a good set of sample wtmp files available for testing in the -turk/NetworkingClass directory, only some of which are shown in the examples below Examples: $ 09-firstLastLogout 1 2 3 #incorrect number of parameters ERROR: Incorrect number of parameters. 09-firstLastLogout 09-firstLastLogout ( <wtmp file path> ) -turk/Networkingciass/var_log_wtmp- USAGE: Ex: 20161017141700 Ex: 09-firstLastLogout -turk/NetworkingClass/var_log_wtmp.1- 20161031095100 09-firstLastLogout 09-firstlastLogout 09-firstLastLogout /var/log/wtmp /var/log/wtmp.1 Ex: Ex: Ex: $ 09-firstLastLogout wtmp-20160101 #file doesn't exist ERROR: specified file does not exist. 09-firstLastLogout 09-firstLastLogout [ <wtmp file path> ] -turk/Networkingclass/var_log_wtmp- USAGE: Ex: 20161017141700 Ex: 09-firstLastLogout -turk/NetworkingClass/var_log_wtmp.1- 20161031095100 09-firstlastLogout 09-firstLastLogout 09-firstLastLogout /var/log/wtmp /var/log/wtmp.1 Ex: Ex: Ex: $ 09-firstLastLogout turk/NetworkingClass/var_log_wtmp-20161109131200 #correct input Script: '09-EirstLastLogout' at 'Wed Nov 9 13:26:40 MST 2016'. Input: '/home/turk/NetworkingClass/var_log_wtmp-20161109131200'. Running: 'last -f /home/turk/NetworkingClass/var_log_wtmp-20161109131200'. There were 44 unique users logged on out of 348 logins/outs during the time period covered in the wtmp data ('/home/turk/NetworkingClass/var_log_wtmp-20161109131200'), "Tue Nov 1 06:35:48 2016' to 'Nov 9 08:58'. The analysis below does not include those who were still logged on or those who were gone but had not logged out when this log was captured, nor does it Write a script called 09-firstLastLogout that will do the following: i. Reads data from a wtmp log file that will be specified on a single command-line parameter. ii. If the file does not exist, is a directory, or there are more or less than one parameters provided, display an appropriate error/usage message and exit gracefully. iii. Finds the first and last person to be on the system during the time period recorded in the wtmp log file specified. The command called last should be used to read the wtmp file and generate the data needed for this report. iv. You may find it helpful to make use of the mktemp command to create a temporary file to process depending on whether the script is run with a filename parameter or not. If you do use mktemp, be sure to remove any temporary files before the script ends. v. Make the output look like that in the examples shown below. I will likely use a different file when I grade the assignments, so it should work no matter what wtmp file is specified. Note that there is a good set of sample wtmp files available for testing in the -turk/NetworkingClass directory, only some of which are shown in the examples below Examples: $ 09-firstLastLogout 1 2 3 #incorrect number of parameters ERROR: Incorrect number of parameters. 09-firstLastLogout 09-firstLastLogout ( <wtmp file path> ) -turk/Networkingciass/var_log_wtmp- USAGE: Ex: 20161017141700 Ex: 09-firstLastLogout -turk/NetworkingClass/var_log_wtmp.1- 20161031095100 09-firstLastLogout 09-firstlastLogout 09-firstLastLogout /var/log/wtmp /var/log/wtmp.1 Ex: Ex: Ex: $ 09-firstLastLogout wtmp-20160101 #file doesn't exist ERROR: specified file does not exist. 09-firstLastLogout 09-firstLastLogout [ <wtmp file path> ] -turk/Networkingclass/var_log_wtmp- USAGE: Ex: 20161017141700 Ex: 09-firstLastLogout -turk/NetworkingClass/var_log_wtmp.1- 20161031095100 09-firstlastLogout 09-firstLastLogout 09-firstLastLogout /var/log/wtmp /var/log/wtmp.1 Ex: Ex: Ex: $ 09-firstLastLogout turk/NetworkingClass/var_log_wtmp-20161109131200 #correct input Script: '09-EirstLastLogout' at 'Wed Nov 9 13:26:40 MST 2016'. Input: '/home/turk/NetworkingClass/var_log_wtmp-20161109131200'. Running: 'last -f /home/turk/NetworkingClass/var_log_wtmp-20161109131200'. There were 44 unique users logged on out of 348 logins/outs during the time period covered in the wtmp data ('/home/turk/NetworkingClass/var_log_wtmp-20161109131200'), "Tue Nov 1 06:35:48 2016' to 'Nov 9 08:58'. The analysis below does not include those who were still logged on or those who were gone but had not logged out when this log was captured, nor does it
Expert Answer:
Answer rating: 100% (QA)
Below is the script as required I have kept the inline comments in the code itself to explain the logic Also following this I have pasted the screensh... View the full answer
Related Book For
Accounting and Auditing Research Tools and Strategies
ISBN: 978-1119441915
9th edition
Authors: Thomas Weirich, Thomas Pearson, Natalie Tatiana
Posted Date:
Students also viewed these programming questions
-
Describe a business transaction that will do the following. a. Increase an asset and increase a liability b. Decrease an asset and decrease a liability c. Decrease an asset and increase an expense d....
-
Required Give an example of a transaction that will do the following: a. Increase an asset and increase equity (asset source event). b. Decrease an asset and decrease equity (asset use event). c....
-
Determine whether the graph is bipartite. You may find it useful to apply Theorem 4 and answer the question by determining whether it is possible to assign either red or blue to each vertex so that...
-
In 2020, A corporation gave the following fringe benefits to its employees (Non-resident alien not engaged in trade/business): To managerial employees - P1,500,000 To rank and file employees -...
-
Assume that you are running four-point bending tests on a number of identical specimens of the same length and cross section, but with increasing distance between the upper points of loading. What...
-
Present a brief operations blueprint for your college bookstore.
-
Lynn Goldsmith is a photographer known for her photographs of famous musicians. In 1981, Goldsmith had a photography session with the singer Prince. Three years later, Vanity Fair obtained a license...
-
The Henry Street Mission uses volunteers to assemble care packages for needy families during the holiday season. The mission would like to organize the work as efficiently as possible. A list of...
-
Explain an existing healthcare initiative that address the disparities veterans face with access to mental health. Explain specific goals of the specific initiative to address the gap veterans face...
-
Halcrow, Inc. expects to replace a downtime tracking system currently installed on CNC machines. The challenger system has a first cost of $70,000, an estimated AOC of $20,000 the first year...
-
ABC is in the gas and oil exploration marketplace. They trade on the NASDAQ under the symbol ABC. In 2019 ABC completely suspended the cash dividend. The marketplace had drooped the value of ABC from...
-
A spring with a K value of 2 0 0 N / m is put vertically on the ground. You compress the spring gradually and stop compressing at a force of 9 8 newtons. Please calculate how much work is done on the...
-
A rectangular beam 2a length and 2b width is loaded by a uniform compressive normal traction (P) as shown: Determine the stresses, strains, and displacement considering the plane stress case. Hint:...
-
3) Use a light (with wavelength 450 nm in vacuum) and nx=2.6. For part (b), To generate the plot you will need to write a Matlab routine to calculate the reflectivity for vacuum wavelengths starting...
-
2) A 3.5 kg block of Titanium is to be melted. Calculate the amount of heat energy, Q, required to raise the temperature of the block from its initial temperature of 10C to its melting point 1680C....
-
A 24.0 kg crate sits on the ground. E a) What is the magnitude of the normal force on the crate? b) The same 24.0 kg crate is suspended from the ceiling by a cable. What is the tension in the cable?...
-
With her new trainer, Gabrielle now bikes at an average speed of 22.5MPH. That is 31.3% faster than she averaged with her old trainer. How fast did she bike, on average, before training with the her...
-
Given find the value of k. es 1 e kx dx = 1 4'
-
Does the Codification contain SEC authorities? If so, what authority does the Codification have over SEC content?
-
Access the AICPA Professional Standards via Checkpoint, and click on By-laws. Under Section 730, determine when can a member receive disciplinary action without a hearing?
-
What tax case by the Supreme Court recognized same-sex marriage?
-
In mice, the copy of the Igf 2 gene that is inherited from the mother is never expressed in her offspring. This happens because the Igf 2 gene from the mother a. always undergoes a mutation that...
-
A female snail that coils to the left has offspring that coil to the right. What are the genotypes of this mother and of the maternal grandmother of the offspring, respectively? a. dd, DD b. Dd, Dd...
-
A cross is made between a green four-oclock plant and a variegated one. If the variegated plant provides the pollen, the expected outcome of the phenotypes of the offspring will be a. all plants with...
Study smarter with the SolutionInn App