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

Open
CloudItaly opened this issue Feb 24, 2024 · 2 comments
Open

pm2 start (at time) #5776

CloudItaly opened this issue Feb 24, 2024 · 2 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

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

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

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

2 participants