From 776d25c0db2794699204bc6547dbb5dfc4b6ec74 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Thu, 22 Aug 2019 22:19:02 -0500 Subject: [PATCH] add JID search support --- Proc-ProcessTable-ncps/bin/ncps | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Proc-ProcessTable-ncps/bin/ncps b/Proc-ProcessTable-ncps/bin/ncps index a1faa05..cf675e1 100755 --- a/Proc-ProcessTable-ncps/bin/ncps +++ b/Proc-ProcessTable-ncps/bin/ncps @@ -27,6 +27,8 @@ sub help{ -F Show major faults. -J Show jail IDs. +-j A comma seperated list of JIDs to search for. +--ji Invert the JIDs earch. -n Show number of threads. @@ -90,6 +92,8 @@ my $cmajor_faults=0; my $numthr=0; my $tty=0; my $jid=0; +my $jids_string; +my $jids_invert=0; # get the commandline options Getopt::Long::Configure ('no_ignore_case'); @@ -126,6 +130,8 @@ GetOptions( 'tty' => \$tty, 'J' => \$jid, 'nc' => \$no_color, + 'j=s' => \$jids_string, + 'ji' => \$jids_invert, ); # print the version info if requested @@ -237,6 +243,20 @@ if ( defined( $rss_string ) ){ }); } +# +# handles the JID search +# +if ( defined( $jids_string ) ){ + my @jids=split(/\,/, $jids_string ); + push( @filters, { + type=>'JID', + invert=>$jids_invert, + args=>{ + jids=>\@jids, + }, + }); +} + # # handles the time search # @@ -286,7 +306,6 @@ if ( $no_color ){ $ENV{ANSI_COLORS_DISABLED}=1; } - # # handles the time search #