pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

pm2 start (at time)

Open CloudItaly opened this issue 1 year ago • 2 comments
trafficstars

Hello. This is my situation.

pm2 start node --name sessioni_approvate -- /root/nodejs_sessioneapprovate/sessioni_approvate.js --cron "0 20 8 * * 1,2,3,4,5,6"

i need to reload this "js" app every day expect sunday at 8:20 am. the app performs a series of checks, writes some things and then the browser closes waiting for the new execution.

However, if I restarted the machine, to be able to start the app again, I have to issue that command.

I don't want that when I give that command, the app runs and then waits for the cron event. I would like to issue the command but the first execution must be at the cron event. It's possible?

CloudItaly avatar Feb 24 '24 15:02 CloudItaly

The cron argument is only for restart strategies and not for starting strategies so this will not work.

My suggestion is to use the OS's cron to schedule the launch of your script.

ultimate-tester avatar Feb 29 '24 08:02 ultimate-tester

I'm going through the issues to find mentions about not auto-starting a new process, which I now created a PR for: #5780

ultimate-tester avatar Mar 08 '24 19:03 ultimate-tester

Feature landed

Update PM2 to 5.4.0

$ npm install [email protected] -g
$ pm2 update

Unitech avatar May 24 '24 12:05 Unitech