forked from bronevet/sight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkillP
More file actions
executable file
·46 lines (42 loc) · 1.64 KB
/
Copy pathkillP
File metadata and controls
executable file
·46 lines (42 loc) · 1.64 KB
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
#!/usr/bin/perl
##//////////////////////////////////////////////////////////////////////////////
## Copyright (c) 2013, Lawrence Livermore National Security, LLC.
## Produced at the Lawrence Livermore National Laboratory.
## Written by the Greg Bronevetsky <bronevetsky1@llnl.gov> / <greg@bronevetsky.com>.
##
## LLNL-CODE-642002
## All rights reserved.
##
## This file is part of Sight. For details, see https://e-reports-ext.llnl.gov/pdf/781752.pdf or
## https://github.com/bronevet/sight.
##
## Licensed under the GNU Lesser General Public License (Lesser GPU) Version 2.1,
## February 1999; you may not use this file except in compliance with the License.
## The full licence is included in file LICENCE and you may obtain a copy of the
## License at:
## https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
## implied. See the License for the specific language governing
## permissions and limitations under the license.
##//////////////////////////////////////////////////////////////////////////////
if(scalar(@ARGV)==0) { die "ERROR: need at least one argument to identify processes to kill"; }
my $ps = `ps -ef |grep $ENV{USER}`;
my @lines = split(/\n/, $ps);
foreach my $line (@lines)
{
my @fields = split(/\s+/, $line);
if($fields[1] != $$) {
foreach my $field (@fields) {
foreach my $killStr (@ARGV) {
if($field =~ /$killStr/) {
print "kill -9 $fields[1]\n";
`kill -9 $fields[1]`;
next;
}
}
}
}
}