SF.net SVN: logwatch:[332] trunk/scripts/services/zypp

[email protected] Sat, 27 Feb 2016 13:45:54 +0000
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 332
          http://sourceforge.net/p/logwatch/code/332
Author:   stefjakobs
Date:     2016-02-27 13:45:54 +0000 (Sat, 27 Feb 2016)
Log Message:
-----------
list users and commands

Modified Paths:
--------------
    trunk/scripts/services/zypp

Modified: trunk/scripts/services/zypp
===================================================================
--- trunk/scripts/services/zypp	2016-02-27 13:19:43 UTC (rev 331)
+++ trunk/scripts/services/zypp	2016-02-27 13:45:54 UTC (rev 332)
@@ -1,10 +1,5 @@
-#!/usr/bin/perl
-###########################################################################
-# $Id$
-###########################################################################
-
 ########################################################
-## Copyright (c) 2013 Stefan Jakobs <[email protected]>
+## Copyright (c) 2013-2016 Stefan Jakobs <[email protected]>
 ## Covered under the included MIT/X-Consortium License:
 ##    http://www.opensource.org/licenses/mit-license.php
 ## All modifications and contributions by other persons to
@@ -25,6 +20,7 @@
 my @remove;
 my @rremove;
 my @radd;
+my %commands;
 
 my @unknown;
 
@@ -38,18 +34,31 @@
          push @install, "$pkg $ver";
       }
    } elsif ( my ( $do, $repo, $url) = ( $line =~ /^\S+ \S+\|(?:(rremove|radd) {0,3})\|([^\|\s]+)(?:\|([^\|]+))?/) ) {
-     if ($repo eq "_tmpRPMcache_") {
-        # ignore
-     } elsif ($do eq "radd") {
-        push @radd, "$repo: $url";
-     } elsif ($do eq "rremove") {
-        push @rremove, "$repo";
-     }
+      if ($repo eq "_tmpRPMcache_") {
+         # ignore
+      } elsif ($do eq "radd") {
+         push @radd, "$repo: $url";
+      } elsif ($do eq "rremove") {
+         push @rremove, "$repo";
+      }
+   } elsif ( my ( $do, $who, $cmd) = ( $line =~ /^\S+ \S+\|(?:(command)\|([^\|\s]+)\|([^\|]+)\|)/ )) {
+      $cmd =~ tr/'//d;
+      $commands{$who}{$cmd}++;
    } else {
       push @unknown, $line;
    }
 }
 
+if (keys %commands) {
+   print "\nCommands:\n";
+   foreach my $who (keys %commands) {
+      print "   $who:\n";
+      foreach my $cmd (keys %{$commands{$who}}) {
+         printf "   %3d: %s\n", $commands{$who}{$cmd}, $cmd;
+      }
+   }
+}
+
 my @k = ( "Installed" , \@install,
           "Removed", \@remove,
           "Repository added", \@radd,

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140