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.
Linux – How to tell number of active users logged into a Django site
apache-2.2lamplinux
Related Topic
- VMware Linux – How to Tell if You Are on a VM or Real Hardware
- Linux – Find users currently logged in using ldap
- Linux Web Server – Proper Permissions for Website Files and Folders
- Linux – Maximum number of users logged simultaneously into Linux
- Linux – How to list logged-in users on Scientific Linux (RHEL clone)
- Linux – Limit number of concurrent users switching to root account
Best Answer
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.