I have project which built by NestJs and I want to change my some datas in every 24 hours, I've decided to use CronJob for that. But when I run my project by pm2(on different clusters), CronJob works once for every cluster and totally it works for cluster count (if I have 8 cluster, it works 8 times). How can I find central point which pm2 doesn't separates that and my codes works only one time?
Your take on the problem appears to be correct - if you run many homogenous processes, each executing the same cronjob, then the outcomes of the cronjob will obviously be duplicated.
There are several solutions to the problem. The most obvious is to split the cron logic off into another Node.js process, so that there's only 1 cron process running at any given moment. This can then be implemented using a variety of techniques:
Alternatively, if you have a central database such as PostgreSQL, you can use it as a point of synchronization - you could insert a new row for each cron invocation, and have consumers (the processes that actually execute tasks) read new rows. If a new row is found, it should be locked via FOR UPDATE, which ensures exclusivity. This is a rudimentary form of network locking. Duplicate invocations can be prevented using a primary key, e.g. based on the date - if you know you're only going to have 1 invocation per day, there can only be one entry with the ID being 2021-11-10.
Finally, look online for existing cron implementations. Some "synchronized cron" libraries already exist that tackle this exact issue, such as https://github.com/percolatestudio/meteor-synced-cron - you may be able to use this as inspiration, or as a starting point for your search.