The main difference between the two methods, in my opinion, will be the level at which you want to schedule work. When using crontab your jobs are scheduled by cron daemons that run on the system.
node-cron , on the other hand, is a pure implementation of JavaScript cron. Thus, the system is not responsible for the launch of tasks, but your V8 engine that performs it. Tasks will be executed as long as your js application is running.
So why would you use one or the other?
It depends on the purpose of your work, where it is best attached. If the job is maintenance work to start the system through crontab. If you want to run a function in node.js periodically use node -cron. If you want to run a bash script, you want to use crontab. So, how you want to do this through a system (bash) or JavaScript is right for you.
source share