Skip to content

Commit

Permalink
afpstats: Check for unexpected output; example in man page
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmark committed Apr 29, 2024
1 parent dc795a8 commit fa67618
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions contrib/shell_utils/afpstats.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ sub main {
my $remote_object = $service->get_object("/org/netatalk/AFPStats",
"org.netatalk.AFPStats");

print "Username PID Login time State Volumes\n";
print "Connected user PID Login time State Mounted volumes\n";

foreach my $user (@{$remote_object->GetUsers}) {
if ($user =~ /name: ([^,]+), pid: ([^,]+), logintime: ([^,]+), state: ([^,]+), volumes: (.+)/) {
my ($name, $pid, $logintime, $state, $volume) = ($1, $2, $3, $4, $5);
printf "%-17s%-9s%-18s%-15s%s\n", $name, $pid, $logintime, $state, $volume;
} else {
print "WARNING Unexpected output: ".$user."\n";
}
}
}
};
if ($@) {
print "Error: $@\n";
exit 1;
Expand Down
12 changes: 11 additions & 1 deletion doc/manpages/man1/afpstats.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,23 @@
<refsect1>
<title>Note</title>

<para><command>afpd</command> must be built with D-Bus support. Check it
<para><command>afpd</command> must be built with D-Bus support. Check this
with "<command>afpd -V</command>".</para>

<para>Additionally, "<option>afpstats = yes</option>" must be set in
<filename>afp.conf</filename>.</para>
</refsect1>

<refsect1>
<title>Examples</title>

<para><programlisting>$ <emphasis remap="B">afpstats</emphasis>
Username PID Login time State Volumes
sandy 452547 Apr 28 21:58:50 active Test Volume
charlie 451969 Apr 28 21:21:32 active My AFP Volume
</programlisting></para>
</refsect1>

<refsect1>
<title>See Also</title>

Expand Down

0 comments on commit fa67618

Please sign in to comment.