Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: CGI daily 'cleanup' task

by twerq (Deacon)
on Aug 28, 2002 at 14:33 UTC ( #193469=note: print w/replies, xml ) Need Help??


in reply to Re: CGI daily 'cleanup' task
in thread CGI daily 'cleanup' task

Does the lock file exist? If so, someone else is already doing a cleanup.

This seems like a good solution for making sure I'm the only agent running...

Wow .. 33%. That's pretty high. After three accesses, the odds are even that you will have run the cleanup. Your choice ..

Let me clarify -- that was just a number I quickly threw out there, but basically I was thinking that there should be a 33% chance that the script will check to see if it needs to run a cleanup process. Which is something like:
if (33% chance) { if (it has been a day or more since last cleanup) { // Do our thing } }
Although now I'm going to have to leave another little file lying around letting my script know when the last cleanup happened. . . starting to seem pretty hacky. Maybe I should just use a scheduler :)

FYI -- I'm building this web application on trusted servers, but have no idea where it's going to be run once I'm done, which is why I'm trying to keep away from relying on cron, and relying on sysadmins to set things like that up properly.

also -- the cleanup is actually going to be doing post-due transactions from a DB.
--twerq

Replies are listed 'Best First'.
Re: Re: Re: CGI daily 'cleanup' task
by talexb (Chancellor) on Aug 28, 2002 at 16:45 UTC
    It sounds like you want a mechanism whereby you do some cleanup if it's been at least 'n' hours since the last cleanup, or if it's a new calendar date since the last cleanup, or if a cleanup's never been done.

    It makes sense not to rely on cron if you don't know where the application is going to be rolled out -- I was only suggesting sticking to the cron format if there was a module that handles that already. Otherwise, go crazy and write your own protocol.

    --t. alex
    but my friends call me T.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2022-08-11 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?