diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-19 06:08:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:41 -0500 |
commit | ef948e53b7a4099663f55a9b1b3a23c6aa100b28 (patch) | |
tree | 67fc9f9d3b0e0b8305d151d8dbe7af4dc7a4e8fa | |
parent | afe0fffc443861f39a9aca9bd1cb0ed73d4fc994 (diff) | |
download | samba-ef948e53b7a4099663f55a9b1b3a23c6aa100b28.tar.gz samba-ef948e53b7a4099663f55a9b1b3a23c6aa100b28.tar.bz2 samba-ef948e53b7a4099663f55a9b1b3a23c6aa100b28.zip |
r8583: nicer smbstatus output
(This used to be commit 0578bcdf7f8919509a78a5c64f94aa5de7e90416)
-rwxr-xr-x | source4/scripting/bin/smbstatus | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus index 9f7566a642..eaf3aa1616 100755 --- a/source4/scripting/bin/smbstatus +++ b/source4/scripting/bin/smbstatus @@ -15,23 +15,55 @@ ok = GetOptions(ARGV, options, "POPT_AUTOHELP", "POPT_COMMON_SAMBA"); if (ok == false) { - println("Failed to parse options: " + options.ERROR); - return -1; + println("Failed to parse options: " + options.ERROR); + return -1; } - -var sessions = smbsrv_sessions(); -if (sessions == undefined) { - println("No sessions"); - exit(0); +/* + show open sessions +*/ +function show_sessions() +{ + var sessions = smbsrv_sessions(); + var i; + var sys = sys_init(); + if (sessions == undefined) { + println("No sessions open"); + return; + } + printf("User Client Connected at\n"); + printf("-------------------------------------------------------------------------------\n"); + for (i=0;i<sessions.length;i++) { + var info = sessions[i]; + var fulluser = sprintf("%s/%s", info.account_name, info.domain_name); + printf("%-30s %16s %s\n", + fulluser, info.client_ip, sys.httptime(info.connect_time)); + } + printf("\n"); } -printVars(sessions); -var trees = smbsrv_trees(); -if (trees == undefined) { - println("No trees"); - exit(0); +/* + show open tree connects +*/ +function show_trees() +{ + var trees = smbsrv_trees(); + var sys = sys_init(); + if (trees == undefined) { + println("No tree connects"); + return; + } + printf("Share Client Connected at\n"); + printf("-------------------------------------------------------------------------------\n"); + for (i=0;i<trees.length;i++) { + var info = trees[i]; + printf("%-30s %16s %s\n", + info.share_name, info.client_ip, sys.httptime(info.connect_time)); + } } -printVars(trees); + + +show_sessions(); +show_trees(); return 0; |