annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
1 #!/usr/bin/perl
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
2 #
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
3 # (c)Peter Gervai, 2013
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
4 #
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
5 # use: ps awxuf | add_vzps.pl
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
6 #
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
7
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
8 while( <> ) {
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
9 my @cmd = split /\s+/;
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
10 my $pid = $cmd[1];
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
11 if( -r "/proc/$pid/status" ) {
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
12 my $veid_line = qx( /bin/grep 'envID:' /proc/$pid/status );
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
13 if( $veid_line =~ /envID:\s+(\d+)/ ) {
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
14 print $1, '; ', $_;
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
15
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
16 } else {
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
17 print "SKIP $veid_line ";
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
18 }
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
19 }
464dea07deb8 Add vzps replacements.
Peter Gervai <grin@grin.hu>
parents:
diff changeset
20 }