Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Cron or running process?

by Elijah (Hermit)
on Apr 28, 2004 at 20:44 UTC ( [id://348946]=note: print w/replies, xml ) Need Help??

in reply to Cron or running process?

Well in your specific application it appears that option 2 and 3 are very similar (with regards to frequency of execution) so the added system resources being chewed up by a deamon running constantly in the background does not outweight the need to be real time. I would go with number 2. This option for your scenerio will be most practical, applicable and resource friendly.

If you fell the need to be almost real time you can setup a cron job to run every minute and check the target files and still be more efficient than a running app in the background. Even if a running app does this very thing (meaning run at startup and poll the file every 60 seconds then sleep for 60 seconds and do it again) it is still using system resources while sleeping.

Replies are listed 'Best First'.
Re: Re: Cron or running process?
by l3nz (Friar) on Apr 29, 2004 at 17:46 UTC
    I'd go for cron, keeping in mind that:
    • It could hang and not work (though the same could be for your own code, and I guess that would be more likely than cron itself)
    • More than one instance of your script could be running at the same time. Play it safe and check before doing things that will break if done by two different process at once. Having a database backend with transactions might help.
    • Log, log and log again. You want to know whether your thing ran, whether it completed okay, what went wrong. Log it before, don't wonder what went wrong afterwards.
    I guess this is my $0.02

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-21 21:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found