I'm building a simple nodejs script that updates a DNS record based on my current IP. The script works fine but I have some concerns regarding how should I run it. The check for my IP must be performed every 5 minutes and I'm facing a dilemma.
Should I use Node's setInterval or should I create a cron job? Which will consume the least RAM and CPU? Please keep in mind that the script runs on a Raspberry Pi Zero with 512MB ram and only 1 core.
I know that the cron
seems a better option but how much better is it? Does it matter given my specs?
Best Answer
Advantages of cron solution
Advantages of daemon solution
Conclusion
I agree with Alexander T that
cron
seems likely to be better, but if your main app is sensitive to background processes it might be better to go with the daemon.