Finding no of active users in FreeBSD 5.2.1

Hello evryone,

I was wondering how can we find the no. of active users in FreeBSD 5.2.1 Is there a way to do that? How can we implement it in source code?
 
What do you mean number of active users? The number of people actually running 5.2? How would putting it in the source help that, if they refuse to upgrade to 7 what makes you think they would upgrade their kernel at all?

Or do you mean number of users on your system, in which case, `w` comes in handy.
 
[cmd=]last | awk '{print $1}' | grep -v -E '(^$|reboot|shutdown)' | sort -u | wc -l[/cmd]

for this month ;)
 
Active users mean the number of users who are currently running atleast 1 process on the system. Can you tellmehow to do it inside the code. Do we have to assign a variable or something?
 
Hey Guys,

I was thinking ...Can we write a sysctl statement inside w.c file so the number of users become a global variable and can be accessed system-wide.

If so, what will be the correct way?

Help!!
 
potterv said:
I was thinking ...Can we write a sysctl statement inside w.c file so the number of users become a global variable and can be accessed system-wide.
Simple question, why?
 
Back
Top