source: gs2-extensions/parallel-building/trunk/src/bin/script/stop-impt.pl@ 30354

Last change on this file since 30354 was 27004, checked in by jmt12, 11 years ago

A script to stop (using kill) a runaway import process and any related TDB processes. Intended to be run via 'rocks host run' to stop runaway imports on the cluster

  • Property svn:executable set to *
  • Property svn:mime-type set to application/x-perl
File size: 781 bytes
Line 
1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6open(FIN, 'ps ax -o pid,command |') or die($!);
7my $line = '';
8while (($line = <FIN>))
9{
10 # Kill import processes
11 if ($line =~ /^\s*(\d+)\s+.*import\.pl/)
12 {
13 my $pid = $1;
14 print STDERR "Killing process: $line";
15 my $cmd = 'kill -KILL ' . $pid;
16 `$cmd`;
17 }
18 # Kill orphaned TDBCLI harnesses (?)
19 elsif ($line =~ /^\s*(\d+)\s+.*(tdbcli|tdb2txt|txt2tdb)/)
20 {
21 my $pid = $1;
22 print STDERR "Killing process: $line";
23 my $cmd = 'kill -KILL ' . $pid;
24 `$cmd`;
25 }
26 # Video processing - expensive
27 elsif ($line =~ /^\s*(\d+)\s+.*(HandbrakeCLI|hive2_ffmpegsvn)/)
28 {
29 my $pid = $1;
30 print STDERR "Killing video processing: $line";
31 my $cmd = 'kill -KILL ' . $pid;
32 `$cmd`;
33 }
34}
35close(FIN);
36
37exit;
Note: See TracBrowser for help on using the repository browser.