Hello Team, I am getting issue after following below mentioned tutorial for set node crons when i set cron and run my index.js file with node command it run properly and crons working fine but issue is as usual when i close the terminal cron is stops working so solution is to use pm2 i used pm2 and start my index.js file and its working fine but after 1 or 2 days my droplet getting slowness issue and not working well i need to restart that and after restart again its working fine for two days and then getting same issue. If anyone have solution for this please let me know i am struggling to finding the way to do this.
I used this tutorial to set my cron application https://www.digitalocean.com/community/tutorials/nodejs-cron-jobs-by-examples
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Heya @info3dbe0e42d43bca7d89b055447b,
So, PM2 is the proper choice for a continuous execution of your NodeJS App.
As for the slowness you are experiencing after a while, check your droplet’s processes, see if you have anything stuck that is running for the last two days.
You can do that with
top
,htop
or by runningAdditionally, check your memory, see if you have any available.
My best best is that your app is leaving some processes unclosed or there are just stuck processes for days. See if that is the case.