Solved

How to automaticaly kill long-lasting processes under Linux?

Posted on 2007-11-24
5
282 Views
Last Modified: 2013-12-16
I'd like to limit the allowed "CPU running time time" for particular applications running on the Linux server.
For instance, renice a PHP script (CGI mode, webhosting environment, PHP under user privileges, executed through Apache) after 1 minute and kill this script if it runs longer than 5 minutes.
Ulimit-based solution is insufficient. SPRI-based solution can only do the first part of such job.

I expect that the best solution would be a bash script executed from a cron job.
What script can perform such tasks?
0
Comment
Question by:er2er
  • 2
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
mikemsd earned 125 total points
ID: 20343062
The program I have used before is AND the Auto Nice Daemon. It can automatically renice processes that have been using too much CPU, and kill off certain ones after a period of time. You can specify by process name which ones you want to nice or kill in it's config file.

http://and.sourceforge.net/
0
 

Author Comment

by:er2er
ID: 20343415
Thank you for this information.
I'm going to check this daemon out and report on this tomorrow (CET).
0
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 50 total points
ID: 20345166
This should do exactly what you need: -

http://www.psmon.co.uk/
0
 

Author Comment

by:er2er
ID: 20346879
Thank you - I found the AND a better solution, as it combines "nice" with "kill" action.
I appreciate the help of both of you.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 20346903
Very welcome... I shall tell Nicola (the author of psmon) your reason for not choosing it -- I'm sure she'll look at adding the support you want :)
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

17 Experts available now in Live!

Get 1:1 Help Now