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

Re: Cron or running process?

by Elijah (Hermit)
on Apr 28, 2004 at 20:44 UTC ( #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.


www.perlskripts.com

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2022-09-28 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?