Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pm2 start (at time) #5776

Closed
CloudItaly opened this issue Feb 24, 2024 · 3 comments
Closed

pm2 start (at time) #5776

CloudItaly opened this issue Feb 24, 2024 · 3 comments

Comments

@CloudItaly
Copy link

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 CloudItaly changed the title pm2 start (time) pm2 start (at time) Feb 24, 2024
@ultimate-tester
Copy link
Contributor

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
Copy link
Contributor

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

@Unitech
Copy link
Owner

Unitech commented May 24, 2024

Feature landed

Update PM2 to 5.4.0

$ npm install pm2@5.4.0 -g
$ pm2 update

@Unitech Unitech closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants