Solved

How to automaticaly kill long-lasting processes under Linux?

Posted on 2007-11-24
5
285 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

910 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

19 Experts available now in Live!

Get 1:1 Help Now