Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Killing Tomcat On Linux

DZone's Guide to

Killing Tomcat On Linux

·
Free Resource

#!/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
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}