http://qs1969.pair.com?node_id=349048


in reply to Cron or running process?

As others have said 2 & 3 are similar.

I've done it both ways for various things, personally I like the ease of cron, but it has some disadvantages you should know as well:

  1. Cron can crash, if you're not aware of this, then your entire process will fail.
  2. cron can be tricky to work with as it doesnt source and environment, stuff that works interactively may not work with cron.

OTOH, if you're daemonising the process you can do some cool stuff like starting it via the init.d, you can see if it is explicitly alive by looking at the process table. The down side is it may die at any time for any reason, memory, a bug, whatever.

Bottom line, is you do what you're comfortable with, and add monitoring. You want to know if your process is alive, or your cron job has run, you want to be alerted if your job abends, or your daemon fails.

There are a couple of methods i use which seem to work quite well.. checking the last update of your log file, will implicitly tell you everything is ok. If possible you should monitor the functionality of your daemon/job, so you can explicitly tell if its run..