Search code examples
phpnode.jsapacheapiserver

CronJob and other logic not working with VPS/Cpanel server


I'm building an API that the data get updated every day at 11 pm as well send multiple notifications using the cronjob.

I'm facing a weird problem that the cronjob works if their requests and the server get busy, but when not and no requests the server more like get shut down!!

This causes other issues too, like big loading time when the server not getting any requests for a while then with the first request it gets took like 14s!!!

Also, I have some endpoints supposed to get cached for 24H, because of that issue, all cached get wiped out of sudden!!

I installed the nodeJS app from the nodejs start applications in cpanel on my host!


Solution

  • Could it be that you need a "persistent" NodeJS app to have it avilable all the time?

    See this https://www.a2hosting.com/kb/developer-corner/making-persistent-node.js-applications