Solved

To Kill Processes

Posted on 2014-11-13
3
207 Views
Last Modified: 2014-11-13
I want to kill all processes in this list with oracleBB60
oracle    7282     1  0 07:44 ?        00:00:00 ora_arcp_BB60
oracle    7284     1  0 07:44 ?        00:00:00 ora_arcq_BB60
oracle    7286     1  0 07:44 ?        00:00:00 ora_arcr_BB60
oracle    7288     1  0 07:44 ?        00:00:00 ora_arcs_BB60
oracle    7292     1  0 07:44 ?        00:00:00 ora_arct_BB60
oracle    8174     1  0 10:25 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    8176     1  0 10:25 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    8178     1  0 10:25 ?        00:00:19 oracleBB60 (LOCAL=NO)
oracle    8180     1  0 10:26 ?        00:00:00 oracleBB60 (LOCAL=NO)
oracle    9351     1  0 13:31 ?        00:00:00 ora_mrp0_BB60
oracle    9353     1  0 13:31 ?        00:00:02 ora_pr00_BB60
oracle    9357     1  0 13:31 ?        00:00:12 ora_pr01_BB60

Getting command not found when I run
-bash-3.2$  ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }'| -exec kill  –f {} \;
-bash: -exec: command not found

What am I missing?
0
Comment
Question by:xoxomos
3 Comments
 
LVL 13

Accepted Solution

by:
Alexander Eßer [Alex140181] earned 350 total points
ID: 40441451
for KILLPID in `ps ax | grep 'my_pattern' | awk ' { print $1;}'`; do 
  kill -9 $KILLPID;
done

Open in new window


or

ps -ef | grep PROCESS | grep -v grep | awk '{print $2}' | xargs kill -9

Open in new window


or use PKILL
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 150 total points
ID: 40441529
This will give you a list of process id's
ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }'

Open in new window


To kill these processes, just give the output of the above (a list) to the kill command:
kill -9 $(ps -ef|grep "oracleBB60"|grep -v grep|awk '{ print $2 }')

Open in new window

0
 

Author Closing Comment

by:xoxomos
ID: 40441613
SEXY :-)  Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now