Question

In: Computer Science

Write a script that checks each minute and reports on who logs in and who logs...

Write a script that checks each minute and reports on who logs in and who logs out.

You can follow the steps below (not the only way):

  1. Using the commands who and cut, extract the list of usernames currently logged in the system
  2. To check after a minute, the sleep command can be used: sleep 60
  3. Get the new list of users logged in after a minute
  4. For each user in the list;
    1. check if they are in the second list using if and grep. You can dump the output of grep to /dev/null when using it in the as a test for the if statement
    2. If the user is not in the second list, print that the user has logged out
  5. For each user in the second list,
    1. If he is in the first list, print that the user has logged in
  6. Rename the second list as the first list
  7. Repeat the process from step 2

Solutions

Expert Solution


Related Solutions

Write a script that checks each minute and reports on who logs in and who logs...
Write a script that checks each minute and reports on who logs in and who logs out. You can follow the steps below (not the only way): Using the commands who and cut, extract the list of usernames currently logged in the system To check after a minute, the sleep command can be used: sleep 60 Get the new list of users logged in after a minute For each user in the list; check if they are in the second...
write a 2-minute sales Elevator Pitch script for an EXISTING product of your choice. Use 5...
write a 2-minute sales Elevator Pitch script for an EXISTING product of your choice. Use 5 real Statistics to back up your case. Research them and make sure they are real statistics.
1. Employee A receives checks from customers and logs them into the register for check receipts...
1. Employee A receives checks from customers and logs them into the register for check receipts (sub-ledger). S/he also posts the receipt to the relevant customer sub-ledger and is responsible for depositing the checks into bank. (Amounts from sub-ledgers are posted into the General ledger). However, in the most recent month, the employee deposited receipts from 3 customers in a personal bank account that s/he opened in a name similar to that of the Company. Which of the following control(s),...
Recent crime reports indicate that, on average, 3.1 motor vehicle thefts occur each minute in the...
Recent crime reports indicate that, on average, 3.1 motor vehicle thefts occur each minute in the United States. What is the probability there are no thefts in a minute? You should use the finite population correction factor for this problem. True False
A table factory requires 500 logs per year. Each time an order for logs is placed,...
A table factory requires 500 logs per year. Each time an order for logs is placed, an ordering cost of $20 is incurred. Each log costs $12 and the holding cost is $2/log/year. Assume that demand occurs at a constant rate and shortages are not allowed and the lead time is zero. (a) If the quantity ordered is 150 units, calculate the total cost incurred (including ordering costs, purchasing costs and holding costs). (b) What is EOQ? (c) What is...
In this assignment, you will write a Python script to increase the population of each city...
In this assignment, you will write a Python script to increase the population of each city in the world_x database by 10% (rounded). First, add a new column to the "world_x" city table using the following MySQL command: ALTER TABLE `world_x`.`city` ADD COLUMN `Population` DOUBLE NULL DEFAULT NULL AFTER `Info`; The existing population data are stored as JSON datatype in the city table in a field named Info. You learned about JSON data types in Module 2. To obtain the...
Assess the following argument by analogy: Go through each of the 3 checks, and then write...
Assess the following argument by analogy: Go through each of the 3 checks, and then write your conclusion about the analogy (strong or weak). Check #1: Specify exactly what is being compared Check #2: List several similarities (both of the objects/events/ideas compared have a, b, and c). Check #3: Find at least 1 key difference if you can (the objects/events/ideas compared are different in d or in e). This is a matter of quality, not quantity Is this weak or...
Write a program that checks if all the input numbers cover 1 to 99. Each ticket...
Write a program that checks if all the input numbers cover 1 to 99. Each ticket for the Pick-10 lotto has 10 unique numbers ranging from 1 to 99. Suppose you buy a lot of tickets and like to have them cover all numbers from 1 to 99. Write a program that reads the ticket numbers from a file and checks whether all numbers are covered. Assume the last ending number in the file is 0. Suppose the file contains...
Write a program using python that loops over each file in a specified directory and checks...
Write a program using python that loops over each file in a specified directory and checks the size of each file.You should create 2-tuple with the filename and size, should append the 2-tuple to a list, and then store all the lists in a dictionary.  
Write paragraphs on each question: 1) Checks and balances among the three branches of government, with...
Write paragraphs on each question: 1) Checks and balances among the three branches of government, with their main functions. 2) Transaction cost analysis of the Articles of Confederation and changes in the US Constitution
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT