mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
c3c3fed10d
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. --HG-- extra : source : 697eb6db7d96dc21e817cd27a7e46ed4ab00f9bb
35 lines
921 B
Python
Executable File
35 lines
921 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""
|
|
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)
|
|
"""
|
|
|
|
from datetime import datetime
|
|
|
|
import psutil
|
|
from psutil._compat import print_
|
|
|
|
|
|
def main():
|
|
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))
|
|
|
|
if __name__ == '__main__':
|
|
main()
|