troubleshooting Question

Search and kill process

Avatar of angelblade27
angelblade27 asked on
3 Comments1 Solution510 ViewsLast Modified:
I'm creating a shell script ( that will be called by a cron) that will kill a process 'openjms' but i don't know how to go about killing it. Usually i grep for the process and get the process ID and kill it manually
that ie
ps -wwwef | grep openjms
root      3511     1  0 01:10 ?        00:00:00 /bin/sh ./ start
root      3517  3511 11 01:10 ?        01:02:26 /opt/third-party/pkg/java-1.4.2_06_SUN/bin/java -Dopenjms.home=/usr/local/openjms-0.7.5 -classpath /usr/local/openjms-0.7.5/lib/ext/mysql-connector-java-5.0.4-bin.jar:/usr/local/openjms-0.7.5/lib/openjms-0.7.5.jar org.exolab.jms.server.JmsServer
 and then
kill -9 3511 3517

When i have to kill it a second time obviously the process id will change so i have to grep and do it again.
I tried
killall openjms
but it says
openjms: no process killed

Is there a way to search for process id of openjms and then kill it, in an automated way?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros