Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

l00pek

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Killing Tomcat on Linux

#!/bin/sh

#args to pass to kill
ARG=$1

for file in `find /proc -regex /proc/[0-9]+ 2> /dev/null`; do

    # FIXME: this will execute the command but I don't think that grep 
    # if `grep org.apache.catalina.startup.Bootstrap $file/cmdline`; then 

    if `grep --silent org.apache.catalina.startup.Bootstrap $file/cmdline 2> /dev/null`; then 

        #get the localname of this process id.
        #cat $file/cmdline

        #now go ahead and kill this guy
        base=`basename $file`
        echo kill $ARG $base
        kill $ARG $base

    fi 

done
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS