Computing.Net > Forums > Unix > process monitor script

process monitor script

Reply to Message Icon

Original Message
Name: Br1an
Date: September 27, 2002 at 23:26:10 Pacific
Subject: process monitor script
OS: unix
CPU/Ram: 256
Comment:

Hi,
does anyone know how to write a script (prob using pgrep/pkill) to kill processes
that making more than 5 copies of ITSELF ??
Thanks


Report Offensive Message For Removal


Response Number 1
Name: mark
Date: September 28, 2002 at 05:25:27 Pacific
Subject: process monitor script
Reply: (edit)

Hi

Test this

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


Report Offensive Follow Up For Removal

Response Number 2
Name: Br1an
Date: September 28, 2002 at 09:00:22 Pacific
Subject: process monitor script
Reply: (edit)

Thanks for replying.. looking at your command, i wonder where i can actually specify the condition "a process that is forking more than X copies of itself" ??
the idea from your command is that you want to send kill signal to ALL processes that
have more than 1 copy, rite ?
by the way, I've just tested this command,
it does not work. this is what i got :

ps -ef | grep | grep -v grep | awk '{print $2}' | xargs kill
Usage: grep -hblcnsviw pattern file . . .
/usr/bin/kill[8]: kill: bad argument count

Hmm..wonder whats wrong with that ?
Again, thanks a lot for any reply


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: process monitor script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge