Answer the question
In order to leave comments, you need to log in
How to track user logins/logouts in the shell language, indicating the operating time and terminal number?
How to track user logins/logouts in the shell language, indicating the time of work and the number of the terminal?
The algorithm itself seems to be clear to me:
1) We write the user, the terminal number and time to the file
2) We compare the minutes after 2 of the current user AND the terminal number, if they match, then we increase the arrival time in the file, otherwise we complete the last. session and record a new one..?
I'm not familiar with the shell language, please don't throw tomatoes :(
Answer the question
In order to leave comments, you need to log in
Hello,
Logins and logouts of users are logged at the kernel level and written to the log, so you can track the time of entry, exit and the amount of session time without any shell scripts, with the last command.
And what does it mean "otherwise we complete the last session"? Do you want to somehow limit the time in the terminal?
There is an assumption that you came up with something in between w, who and last. Read about wtmp/utmp - you can get by with a parser.
There is also an assumption that this is another shkolota throws off his puzzles here. Because in real life no one puts a restriction like "this must be done exactly on / bin / sh"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question