Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: cleanup a cancelled CGI script

by zebedee (Pilgrim)
on Jun 08, 2004 at 19:58 UTC ( #362520=note: print w/replies, xml ) Need Help??

in reply to Re: cleanup a cancelled CGI script
in thread cleanup a cancelled CGI script

I think (on Windows, anyway) that you'd have to have a sweeper (reaper?) process that comes along every hour or so looking for ZIP files that are older than, say, one hour, and assume that they are incomplete, and delete them. Or you could add them to a database, or send them to another process, whose job it is delete any ZIPs in its list (or database) that are older than x hours.

Replies are listed 'Best First'.
Re^3: cleanup a cancelled CGI script
by cLive ;-) (Prior) on Jun 08, 2004 at 21:22 UTC
    Why not just do it in the script when it runs?
    my $tmp_dir = "/path/to/tmpdir"; opendir(TMPDIR,$tmp_dir) || die $!; -M "$tmp_dir/$_" > 1/24 and unlink "$tmp_dir/$_" for (grep /zip/, read +dir(TMPDIR)); closedir(TMPDIR);
    or similar (untested).

    cLive ;-)

      That's going to result in some concurrency problems.
        In what way? All I'm doing is removing tmp files over an hour old?!?

        cLive ;-)

Re^3: cleanup a cancelled CGI script
by zakzebrowski (Curate) on Jun 08, 2004 at 20:06 UTC
    ++ That's what I would've recommeneded. (Or, similarly, use one of the Win32::Process and on startup, put pid into database, then when pid dies, have a second process kill the pid related to the .zip file...)

    Zak - the office

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://362520]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2021-12-04 08:41 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (30 votes). Check out past polls.