javascript - program a task with node.js... cron or setInterval? -


maybe seems odd question... don´t know how program task... o rather, don´t know wich 1 best solution. finish web app , needs everyweeks, every monday, execute "special" piece of code, can´t invoked anywhere else.

the cron solution looks better, piece of code isolated, if code , rest of application 2 diferents programs. , worst handicap of cron solution (even tough suposse can solved), when call javascript file cli node cron.js makes job, never ends... normal?? or depends code?? becouse don´t want execute 1 instance, , next week, first instance still running, run second, , everyweeks same problem.

the "setinteval" solution setting time day, , testing if monday (on monday makes action)... or maybe setting time week (604800000 miliseconds)... solution hasn´t these problems, last, consumes lot of resources (i think...no?).

what best solution?? different?? , if cron best... how stop task? (uuuuuhhhh maybe other programed task cron -a shell- 1 minute after kill node task... uuummm little botched job).

thank much.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -