I'm a server admin for a university, and we have 4 CentOS servers that students can use for their projects in various classes. The CS professors have asked me to come up with a way to track a user's active time on the machine. For example, in the event that at the end of the semester little Timmy is failing and his mom is making a fuss, the professors want to be able to say that Timmy was only active for 37 minutes on the server for the whole semester. Log in time alone is not sufficient, because a user could be logged in and inactive.
I've tried using the w
command, but it only gives a user's idle time. I've also tried writing scripts that calculate active by using bash history and the history <user>
command, but the timestamps are only logged when the command is executed. In this case active time is defined as the user typing or interacting with the server. What would be ideal is exactly what the w
command does with idle time, but for active time.
Any ideas?
while true ; do echo "*"; done
enough to be "active"? Is executing a calculation an idle time? On the other hand running and evaluating traditional Unix accounting might be a lot of extra work to do...readline()
?