A. OK, then who/what runs "node index.js"? Would there also be a systemd service to launch it or something like that?
B. I didn't mean express.js itself is bad. But I do think it is a questionable practice to run a web server on a database host. Unless it is a developer machine where you run all services on the same machine for convenience.
C. You can script cron job creation. The "crontab -e" lets you edit cron job definitions interactively. From a script, you can run "crontab /path/to/my/cronjob.definitions" and it will replace user's current scripts with whatever is in cronjob.definitions.
I see the value of node-cron – it could run some business logic on schedule, for example. I'm not sure I'd use it for backing up databases though!
Hi
A. Index.js can be launched by manually if you just want to learn something to want to run in local or want to do any task only once, In ideal scenario it will be run by system when web server starts and it will be constantly listening.
B. Yes you are right but some applications may have web server and db host on single instance and i haven't covered any production ready or best practices to get things done in this article, but surely it is not to hard to search i guess.
C. I haven't tried crontab but the goal is to run it in certein time after setting it one time in code and avoid manual task by user.
Hope my answer make sense :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A. OK, then who/what runs "node index.js"? Would there also be a systemd service to launch it or something like that?
B. I didn't mean express.js itself is bad. But I do think it is a questionable practice to run a web server on a database host. Unless it is a developer machine where you run all services on the same machine for convenience.
C. You can script cron job creation. The "crontab -e" lets you edit cron job definitions interactively. From a script, you can run "crontab /path/to/my/cronjob.definitions" and it will replace user's current scripts with whatever is in
cronjob.definitions.I see the value of node-cron – it could run some business logic on schedule, for example. I'm not sure I'd use it for backing up databases though!
Hi
A. Index.js can be launched by manually if you just want to learn something to want to run in local or want to do any task only once, In ideal scenario it will be run by system when web server starts and it will be constantly listening.
B. Yes you are right but some applications may have web server and db host on single instance and i haven't covered any production ready or best practices to get things done in this article, but surely it is not to hard to search i guess.
C. I haven't tried crontab but the goal is to run it in certein time after setting it one time in code and avoid manual task by user.
Hope my answer make sense :)