]> arthur.barton.de Git - netatalk.git/blob - contrib/shell_utils/afpstats
AFP statistics via dbus IPC
[netatalk.git] / contrib / shell_utils / afpstats
1 #!/usr/bin/env python
2
3 usage = """Usage:
4 python afpstats.py
5 """
6
7 import sys
8 from traceback import print_exc
9 import dbus
10
11 def main():
12     bus = dbus.SystemBus()
13
14     try:
15         remote_object = bus.get_object("org.netatalk.AFPStats",
16                                        "/org/netatalk/AFPStats")
17
18     except dbus.DBusException:
19         print_exc()
20         sys.exit(1)
21
22     iface = dbus.Interface(remote_object, "org.netatalk.AFPStats")
23
24     reply = iface.GetUsers()
25     for name in reply:
26         print name
27
28 if __name__ == '__main__':
29     main()