Kill those processes


Kill those processes


Here are some nifty one liners to kill lots of processes based on a search string…. USE WITH CAUTION (no really!).

Here is the basic command:

$ for pid in $(ps -ef | awk '/regex search string/ {print $2}'); do kill -9 $pid; done

Here is one that will kill all jobs associated with Pentaho's Data Integration jobs:

$ for pid in $(ps -ef | awk '/(kitchen\.sh)|(spoon\.sh)|(java)/ {print $2}'); do kill -9 $pid; done

To kill job specific commands pids, you can use a portion of the name in the command such as this:

$ for pid in $(ps -ef | awk '/CheetahMail/ {print $2}'); do kill -9 $pid; done

And because the Job Name is passed as a parameter from to to java, the one liner will kill all of them.

Of course, a kill –9 is a bit rough so you may try simply killing the process (without the –9).

$ for pid in $(ps -ef | awk '/regex search string/ {print $2}'); do kill $pid; done

Hope this helps cleaning up run away wild adolescent pids that should have never been let out of the laboratory.

You might also like

Simple Bash Script To Email Server Status


I didn't want to constantly have to log into my servers in order to check on key performance indicators so I decided to write a simple script that would do the checking for me. After collecting results, the script emails them to me. There are a few tools called within the script you might need to install. I also convert any tabs into spaces in order to make sure things line up nicely inside my email. #!/bin/bash SERVER="myserver001" TOEMAIL="" FROMEMAIL="myserver001@myserverscom" # Who is logged in and what are they up to WHO=`w` #



How to fix: “PageHandlerFactory-Integrated” has a bad module when setting up ASP.NET


I was recently setting up IIS 7.5 on Windows 2008 R2 for an ASP.NET site and came across the following 500 error: Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list. After a bit of searching, it turns out ASP.NET was not completely installed with IIS even though I checked that box in the "Add Feature" dialog. I found a number of suggestions but found this command. It fixed my issues and got rid of the error. %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i For a 32 bit system, use the