Kill Linux processes

We have an old messy thirdparty application at work that uses Oracle. Sometimes the application tends to lock the Oracle system and use a LOT of threads, leaving the system pretty much unresponsive. To be able to kill all 1000+ Oracle-plus processes i created a small script that kills all processes.

Put the following lines in scriptfile and call it “”.

process_id=`ps aux | grep $1 | grep -v root | grep -v grep | awk '{print $2}'`
if [ $? -eq "0" ]; then
        echo "Killing process $process_id\r\n";
        for i in $process_id;do kill -9 $i;done

Make the script executable with “chmod a+x”.

Run the script with the command “./ ora” to kill all processes containing the name “ora”.

Have fun but use at your own risk!

Leave a Comment

Your email address will not be published. Required fields are marked *