Solved

How to automaticaly kill long-lasting processes under Linux?

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

773 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