The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
When kill doesnt work, how to kill a process ? VijayHegde UNIX for Advanced & Expert Users 3 05-12-2006 05:24 PM
Automatic Kill -help lancemendioro UNIX for Dummies Questions & Answers 5 07-03-2005 11:29 AM
Script to kill process Lestat Shell Programming and Scripting 5 06-15-2005 01:09 PM
Script to kill all child process for a given PID sanjay92 UNIX for Dummies Questions & Answers 4 03-21-2002 03:28 PM
Script to kill stranded/orphan process by users. rjohnson Shell Programming and Scripting 4 03-07-2002 10:37 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-09-2008
onisoc onisoc is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
[REQ] Automatic script kill process

HI,
I'm using CentOS 5.1 x86_64, CPanel ..
a lot of my users used too much resource, i want to write a script to kill all of them.
Eg: LFD always notify me:

Time: Sun Apr 27 07:40:08 2008
Account: xxxx (my user)
Resource: Virtual Memory Size
Exceeded: 110 > 100 (MB)
Executable: /usr/bin/php
Command Line: php /home/xxxx/public_html/import.php
PID: 20897
Killed: No

or .

Time: Sat Apr 26 18:40:50 2008
Account: xxxx (my user)
Resource: Process Time
Exceeded: 7305 > 1800 (seconds)
Executable: /usr/bin/php
Command Line: /usr/bin/php /home/xxxx/public_html/index.php
PID: 27308
Killed: No

Now, can you help me ??
  #2 (permalink)  
Old 05-10-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,957
what is that you are trying to achieve ?

what is the difficulty in the approach or answer you had tried ?

Could you please post what you had tried first ?
  #3 (permalink)  
Old 05-11-2008
onisoc onisoc is offline
Registered User
  
 

Join Date: May 2008
Posts: 2
Sorry, i'm not good at English.
I found out the option of csf (ConfigServer Security & Firewall) to kill all process over 180 seconds and over 100Mb RAM resource.
And now, i want you help me write a script kill all mySQL process over 15 seconds anyone can help me ?
I'm using CentOS 5.1 and Cpanel
  #4 (permalink)  
Old 05-25-2009
cocoon cocoon is offline
Registered User
  
 

Join Date: May 2009
Posts: 1
killall mysql

Well, if you want to kill everything from a specific daemon then i guess you could use this

PID=`ps -ef |grep mysql |grep -v grep | awk '{print $2}'`
for i in $PID; do echo "killing MySQL process with PID = $i"; kill -9 $i; done

bare in mind that this will also kill the MySQL daemon...Therefore better used as a stop script.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0