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
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...
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...
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 a bash script file that tests each file entry in the current directory. It should...
Write a bash script file that tests each file entry in the current directory. It should determine if it is a file or directory. If it is a file, it will determine if it is readable or not. If it is readable, it will display only the first 4 lines to the terminal in sorted order (just sort the first 4 lines). If it is a directory, it should display the contents of that directory (the files and subdirectories). NOTE:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT