Bug 930808 - Upgrade to psutil 2.1.3; r=glandium
psutil 2.1.3 is replacing psutil 1.0.1. There are numerous bug fixes and feature enhancements in psutil worth obtaining. Source code was obtained from https://pypi.python.org/packages/source/p/psutil/psutil-2.1.3.tar.gz and uncompressed into python/psutil without modification except for the removal of the egg-info directory and the .travis.yml file.
This commit is contained in:
@@ -7,9 +7,14 @@
|
||||
"""
|
||||
A clone of 'who' command; print information about users who are
|
||||
currently logged in.
|
||||
|
||||
$ python examples/who.py
|
||||
giampaolo tty7 2014-02-23 17:25 (:0)
|
||||
giampaolo pts/7 2014-02-24 18:25 (:192.168.1.56)
|
||||
giampaolo pts/8 2014-02-24 18:25 (:0)
|
||||
giampaolo pts/9 2014-02-27 01:32 (:0)
|
||||
"""
|
||||
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
import psutil
|
||||
@@ -17,14 +22,13 @@ from psutil._compat import print_
|
||||
|
||||
|
||||
def main():
|
||||
users = psutil.get_users()
|
||||
users = psutil.users()
|
||||
for user in users:
|
||||
print_("%-15s %-15s %s (%s)" % \
|
||||
(user.name,
|
||||
user.terminal or '-',
|
||||
datetime.fromtimestamp(user.started).strftime("%Y-%m-%d %H:%M"),
|
||||
user.host)
|
||||
)
|
||||
print_("%-15s %-15s %s (%s)" % (
|
||||
user.name,
|
||||
user.terminal or '-',
|
||||
datetime.fromtimestamp(user.started).strftime("%Y-%m-%d %H:%M"),
|
||||
user.host))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user