#!/usr/bin/perl use strict; use warnings; open(FIN, 'ps ax -o pid,command |') or die($!); my $line = ''; while (($line = )) { # Kill import processes if ($line =~ /^\s*(\d+)\s+.*import\.pl/) { my $pid = $1; print STDERR "Killing process: $line"; my $cmd = 'kill -KILL ' . $pid; `$cmd`; } # Kill orphaned TDBCLI harnesses (?) elsif ($line =~ /^\s*(\d+)\s+.*(tdbcli|tdb2txt|txt2tdb)/) { my $pid = $1; print STDERR "Killing process: $line"; my $cmd = 'kill -KILL ' . $pid; `$cmd`; } # Video processing - expensive elsif ($line =~ /^\s*(\d+)\s+.*(HandbrakeCLI|hive2_ffmpegsvn)/) { my $pid = $1; print STDERR "Killing video processing: $line"; my $cmd = 'kill -KILL ' . $pid; `$cmd`; } } close(FIN); exit;