1 |
Alan McKinnon wrote: |
2 |
> On Monday 28 April 2008, Joris Dobbelsteen wrote: |
3 |
>> Dear, |
4 |
>> |
5 |
>> I'm looking for a script that can kill an application after it has |
6 |
>> been running for a 'long' time. I like to measure the start time (as |
7 |
>> it offloads work, the CPU time time is not a good estimate). Does |
8 |
>> anyone have something useful or some pointers to something I can use |
9 |
>> for this? |
10 |
>> |
11 |
>> Preferably the script should monitor the processes that are currently |
12 |
>> running. |
13 |
> |
14 |
> Assuming by "long time" you mean wall clock time, I would try this |
15 |
> approach: |
16 |
> |
17 |
> 1. start your app from a wrapper script that starts your app then |
18 |
> creates a file named like /var/run/my-monitor/<pid> and contains the |
19 |
> output from 'date' when it was started. |
20 |
> 2. write another script that will read all files in /var/run/my-monitor/ |
21 |
> and calculate the difference between start time and current time. If it |
22 |
> passes some threshold, kill the process with the PID of the filename |
23 |
> 3. run this second script from cron every minute: |
24 |
> * * * * * root my-monitor-killer |
25 |
> |
26 |
> alan |
27 |
|
28 |
Thanks for your support, however I'm looking for more of less something |
29 |
already created (sames. |
30 |
|
31 |
However afer a complete day searching (total time) I refound what I had |
32 |
spotted a couple weeks earlier: |
33 |
<http://sial.org/code/perl/scripts/timeout.pl> |
34 |
It doesn't pass back exit codes, which is a major problem for me, as I |
35 |
rely on them (in the upper level script)... |
36 |
|
37 |
Regarding pam_limits: I'm a user on the box, not the admin... So this |
38 |
won't work. |
39 |
|
40 |
- Joris |
41 |
|
42 |
-- |
43 |
gentoo-user@l.g.o mailing list |