admin管理员组文章数量:1429953
I am scheduling a script to run every minute using the following command:
pm2 start my-script.js --cron "* * * * *"
This does make the script run every minute, but here is the issue - if the first run of the script takes more than one minute, it seems like PM2 is killing that instance and starting a new one. This script finishes within seconds most of the time but it sometimes needs to run for a few minutes. I expected PM2 to simply run a new instance of the script after a minute has elapsed and let the previous run finish.
I have some logs from this script showing time elapsed every 5 seconds. Checking the live logs for the script with pm2 logs my-script
shows that logs from the first run of the script suddenly stop when the second run starts.
How can I tell pm2 to start another instance of the script concurrently if the previous run has not finished yet?
本文标签: javascriptPM2 running script instances concurrentlyStack Overflow
版权声明:本文标题:javascript - PM2 running script instances concurrently - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745554803a2663120.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论