Is there a way to find the number of users that are currently logged into a Django site running on Linux? I need to restart the server and I want to make sure there are 'few enough' people that it won't be too much a hassle.
Is there a way to find the number of users that are currently logged into a Django site running on Linux? I need to restart the server and I want to make sure there are 'few enough' people that it won't be too much a hassle.
To see what users are logged into Linux, you can use
w
orwho
.The output of
w
on my machine:The output of
who
on my machine:To see which users are logged into an application, such as WordPress or Joomla, will require different, application specific methods, however.
Since you're using Django, you will need to programmatically query the
session
model for non-expired sessions. Check out the Q/A titled "How to get the list of the authenticated users?" over on StackOverflow for a more thorough explanation.How about apache mod_status.
http://httpd.apache.org/docs/2.0/mod/mod_status.html