-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sat, Apr 07, 2007 at 12:00:14PM -0400, William L. Maltby wrote: > > 2) You are forgeting to take starting up time in consideration > > > > Say a problem will take 2 seconds to start up, due to > > any reason (disk I/O, memory, swap etc). If you specify 4 seconds > > as the limit, the problem will actually run for only 2 seconds. > > > > I have no idea how to solve this second issue. > > > > Run the pre-defined script with a nice command (maybe -20, etc.), start > the process in background (with a somewhat smaller nice?), capture it's > start time and the current time (both in seconds since epoch), take > difference between them and subtract that from desired run duration, > round to seconds/minutes, ..., use that value. Hummm, I still don't see how that can work. my_prio=getpriority(PRIO_PROCESS,0); if (!(cpid=fork())) { setpriority(PRIO_PROCESS,0,-20); execvp(...); } some_magic(); setpriority(PRIO_PROCESS,cpid,my_prio); alarm(limit_time); So here I have the cpid, which is the PID of the process. How can I know when the startup is finished ? What is this some_magic() function you are proposing ? One last quiestion: how off-topic are we ? :) ehehehe - -- Rodrigo Barbosa "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFGF8OrpdyWzQ5b5ckRAiwAAJwNARD9noXeSoi29QhN7GhHwTn+sACcD4P3 6Xiyz7nFj5YjKRDiWvqaGa0= =C7wi -----END PGP SIGNATURE-----