Solved

To Kill Processes

Posted on 2014-11-13
3
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

717 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