Solved

To Kill Processes

Posted on 2014-11-13
3
211 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

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

Suggested Solutions

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

937 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

10 Experts available now in Live!

Get 1:1 Help Now