[REQ] Automatic script kill process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [REQ] Automatic script kill process
# 1  
Old 05-09-2008
[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  
Old 05-10-2008
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 ? Smilie
# 3  
Old 05-11-2008
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 Smilie anyone can help me ?
I'm using CentOS 5.1 and Cpanel
# 4  
Old 05-25-2009
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with write a master script to automatic 1000 process

Hi, I just random create 1000 folder which range from 0-20,000 . Inside all the folder, I have copy over the same program named as run.sh to run in each folder. Can I know that how to write a master script to let it automatic run the "run.sh" in each different random folder create? Some... (5 Replies)
Discussion started by: perl_beginner
5 Replies

2. HP-UX

System not responding and Automatic process kill

Hi All, One of our servers stopped responding , unable to take any logins into it, the response is almost nil...later it resumed Also during this time one of our application processes which was costly on memory got killed..is it an OOM kill? Would like to know to know how to avoid such... (4 Replies)
Discussion started by: baanprog
4 Replies

3. Shell Programming and Scripting

Script to kill the specific process

Hi I have the process to kill regulary, but the PSID is dymatic change and not sure how to kill the specific process ID Check the tradekast_rvd is running , if such process, kill the els process id ps -e f |grep tradekast_rvd ps -ef |grep els then I kill els process id ... (2 Replies)
Discussion started by: linux_user
2 Replies

4. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

5. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

6. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

7. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

8. Shell Programming and Scripting

(Req)Shell script req

HI All Im new to shell scripting...kindly plz help me... I need a shell script for: We have to take export of all db's on daily basis from all svr's and keep these export backups on diffrent server. Plz help. Regards Gaurav (5 Replies)
Discussion started by: ergauravtaneja
5 Replies

9. UNIX for Dummies Questions & Answers

Automatic Kill -help

Hello We are using UNIX, (?) there were reports to us thAt their login was automatically killed, however we (root) did not issue a kill -9 PID, can anyone give me an idea what happen. To add, the user is not idled, he is actually doing something. also, i search all the thread, donno if i... (5 Replies)
Discussion started by: lancemendioro
5 Replies

10. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies
Login or Register to Ask a Question