1835199 Members
3364 Online
110077 Solutions
New Discussion

Re: script

 
SOLVED
Go to solution
Mark Mitchell
Trusted Contributor

script

Is there a way to create a script that can be fired off that scans for all processes like "cognos" and kills them.
2 REPLIES 2
boley janowski
Trusted Contributor
Solution

Re: script

ps -ef |grep cognos | grep -v grep | awk '{print $2}' | xargs kill
Jim Moffitt_1
Valued Contributor

Re: script

Try this:

#!/bin/sh
ps -ef|grep cognos|grep -v grep | awk '{print $2}'|
while read i
do
kill -9 $i
done