This file is indexed.

/usr/bin/parkill is in mpich 3.2-7+b1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /usr/bin/perl
# -*- Mode: perl; -*-
#
# Kill all processes running a specified command
#
# Many systems also have the "killall" command; this should be used instead
# if it is available.
#
# This script relies on the ps command; where possible, it uses the
# /proc/<pid>/cmdline interface to more reliably access the commandline
# (to avoid matching command line parameters as if they were functions).
#
$user = $ENV{'LOGNAME'};
$progname = "";
$noaddresses = 1;
$debug = 0;
$verbose = 0;
$testing = 0;
foreach $_ (@ARGV) {
    if (/-debug/) {
	$debug = 1;
    }
    elsif (/-verbose/) { 
	$verbose = 1;
    }
    elsif (/-user=(.*)/) {
	$user = $1;
    }
    elsif (/-help/ || /-usage/) {
	print STDOUT "$0 [ -debug ] [ -verbose ] [ -user=name ] program\n";
	print STDOUT "Kill all processes running \"program\".  To use the -user option
you must have superuser privilege.\n";
	exit(1);
    }
    $progname = $_;    
}

if ( $progname eq "" ) {
    print STDERR "You must specify a program name\n";
    exit(1);
}

print "user is $user\n" if $debug;
#
# Get pids
$remoteps = "ps";
$sysname=`uname -s`;
chop $sysname;
# Try to get nicer behavior from GNU ps.
$ENV{'COLUMNS'} = 200;
$ENV{'PS_PERSONALITY'} = "linux";
if ($sysname eq "Linux") {
    print "linux style ps\n" if $debug;
    # The -width option can cause trouble, even with GNU ps, if the ps 
    # program either doesn't support it or 
    #$psopts = "-width 200 -lfu"; # LINUX
    $psopts = "-lfu"; # LINUX
    $pidloc = 3;  # 4 sometimes?
} 
elsif ($sysname eq "SunOS" || $sysname eq "IRIX64") {
    print "solaris style ps\n" if $debug;
    $psopts = "-fu";  # Solaris
    $pidloc = 2;
}
elsif ($sysname eq "OSF1" ) {
    $psopts = "-fu";  
    $pidloc = 1;
}
elsif ($sysname eq "Darwin") {
    $psopts = "-aux -U";
    $pidloc = 1;
}
else {
    print STDERR "Unsupported system \"$sysname\"\n";
    exit(1);
}

open( FD, "$remoteps $psopts $user |" ) || die "Cannot execute ps\n";

while (<FD>) {
    print $_ if $verbose;
    # Skip lines that may match this command
    if (/tcsh/) { next; }
    if (/grep/) { next; }
    if (/perl/) { next; }
    if (/\/bin\/sh /) { next; }
    if ($progname ne "mpiexec" && /mpiexec/) { next; }
    print $_ if $debug;

    my @items = split(/\s+/);
    my $pid   = $items[$pidloc];
    print "PID for this job is $pid\n" if $debug;
    my $procfile = "/proc/$pid/cmdline";
    print "Looking for $procfile\n" if $debug;
    # We *CANNOT USE* -s with a file in /proc because -s filename returns
    # false alwyas ! (BUG BUG BUG).  Instead, we try to open and read from it
    $rc = open PFD, "<$procfile";
    if ($rc) {
	my $cmdline = <PFD>;
	$cmdline =~ s/\r?\n//;
	print "Cmdline in /proc/$pid is $cmdline\n" if $debug;
	if ($cmdline =~ /^$progname/ || $cmdline =~ /^\.\/$progname/) {
	    print "Found $progname in /proc/$pid/cmdline\n" if $debug;
	    $pids[$#pids+1] = @items[$pidloc];
	}
	close PFD;
    }
    else {
	# Just try to match the commandline to the entire ps output.
	if (/$progname/) {
	    $pids[$#pids+1] = @items[$pidloc];
	}
    }
}
close FD;

if ($#pids >= 0) {
    print "Processes to kill are " . join(',',@pids) . "\n" if $debug;
    if ($testing) { exit 0; }
    foreach my $sig ("INT","QUIT","KILL") {
	my $cnt = kill $sig, @pids;
	print "Signaled (SIG$sig) $cnt processes\n" if ($debug || $verbose);
    }
}
else {
    print "No processes matched $progname for user $user\n" if $verbose;
}