view add_vzps.pl @ 5:464dea07deb8 default tip

Add vzps replacements.
author Peter Gervai <grin@grin.hu>
date Wed, 07 May 2014 16:23:45 +0200
parents
children
line wrap: on
line source

#!/usr/bin/perl
#
# (c)Peter Gervai, 2013
#
# use: ps awxuf | add_vzps.pl
#

while( <> ) {
  my @cmd = split /\s+/;
  my $pid = $cmd[1];
  if( -r "/proc/$pid/status" ) {
    my $veid_line = qx( /bin/grep 'envID:' /proc/$pid/status );
    if( $veid_line =~ /envID:\s+(\d+)/ ) {
      print $1, '; ', $_;
      
    } else {
      print "SKIP $veid_line ";
    }
  }
}