This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
Subject: Re: killing processes From: Charles Galpin <cgalpin@lighthouse-software.com> Date: Fri, 28 Jan 2000 00:12:29 -0500 (EST) On Fri, 28 Jan 2000, Reiner Rusch wrote: > I'm wondering if it's possible to kill processes automatically (as a > cron-job?). > I've managed to setup Linux and Apache and now I tried to kill the machine > by executing several processes to find out, how the machine reacts. I wrote > a little perl script (cgi) that calls itself. My provider has the option > that a primary process (not a child-process via fork-- lol!) would be killed > after 6 seconds. That's -perhaps- to little time (especially for > search-engines!), but it would made sense! So, my problem is, how to make > the engine safe? Perhaps that it kills routines, called by "nobody" after 1 > or 2 minutes! And what about child-processes or routines called by the > primary process (is this different?)? I've seen this done in perl cgi scripts to prevent them from taking too long - put the following in your script, right after the #!/usr/bin/perl alarm(6); If the program is still running after 6 seconds it will send an SIGALRM signal to itself and die. You might want to define a handler, and catch it to do cleanup, then exit. ===