in reply to Capturing a Browser Timeout Signal

It's been my experience that when a browser times out, the script is NOT killed in anyway; it just continues to run.

Try this and see what happen: create a script like

#!/usr/bin/perl sleep 86400;
and hit it from your web browser. Wait for the browser to timeout and see if the script is still running via "ps ax". I think you'll find that it is.

Replies are listed 'Best First'.
Re: Re: Capturing a Browser Timeout Signal
by skazat (Chaplain) on May 25, 2001 at 03:18 UTC
    even if the script still runs, the script sometimes gets killed by the webserver, usually script ran as 'nobody' or started by the webserver will time out to keep resources in the clear. perhaps this is really what I should be asking. how do I capture when the server kills the process

     

    -justin simoni
    !skazat!

      Try trapping the following signals:

      HUP, INT, QUIT, KILL, TERM, STOP, ABRT

      One of those will probably do it but I'm not sure which.

      To trap a signal, use the following:

      $SIG{KILL} = sub { print "This is my signal handling code. Log messages here.\n"; };

      BTW, you can get a list (in the form of a single string separated by single spaces) of all the signals your system supports like this:

      use Config; print "$Config{sig_name}\n";

      HTH

      bbfu
      Seasons don't fear The Reaper.
      Nor do the wind, the sun, and the rain.
      We can be like they are.

        You have forgotten PIPE which it most likely is.
      Are you using Apache? My experience is that scripts will go on long after the connection is dropped.

      What type of run-time are you talking about? Minutes, Hours, Days?

      -Lee

      "To be civilized is to deny one's nature."