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?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745554804a4632754.html
评论列表(0条)