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

Run Scheduler with PM2 #3

Closed
arwanfiles opened this issue Apr 23, 2017 · 5 comments
Closed

Run Scheduler with PM2 #3

arwanfiles opened this issue Apr 23, 2017 · 5 comments

Comments

@arwanfiles
Copy link

Hi,
can I run adonisjs-scheduler as service with pm2?
or how to run scheduler on application start

regards,
Arwani

@linchpinstudios
Copy link

I'm not sure if it's the best way to run it, but I added the scheduler to the bootstrap for http before the const Server = use('Adonis/Src/Server') line.

      /*
      |--------------------------------------------------------------------------
      | Run Scheduler
      |--------------------------------------------------------------------------
      |
      | Run the scheduler on boot of the web sever. 
      |
      */
      const Scheduler = use('Adonis/Addons/Scheduler')
      Scheduler.run()

@hoangmy92
Copy link

Did you try to run your process on binary mode?
http://pm2.keymetrics.io/docs/usage/process-management/#binary-code-execution

pm2 start ./ace -- scheduler:run

It should work :)

@nrempel
Copy link
Owner

nrempel commented Jun 29, 2017

Thanks @hoangmy92, that is what I would recommend.

Closing for now, feel free to re-open if there are any issues.

@prashanth1k
Copy link

prashanth1k commented Jun 30, 2019

My apologies to piggy-back on an old issue. Just wanted to point out that you would now use the following command instead..

pm2 start ./ace -- run:scheduler

You can also see the above when you go to adonis server directory and enter command -

node ace --help

@davidalexamos
Copy link

Thanks for the command pm2 start ./ace -- run:scheduler, it works perfect, but I am trying to do the same via the config file. I have tried this in the config but it does not start the app.

{ name : "megsapp-sim-card-process", cwd : "/opt/megsapp-sim-card-process/", script : "./ace", args : "scheduler:run", error_file : "/var/log/megsapp-sim-card-process/error.log", out_file : "/var/log/megsapp-sim-card-process/out.log", }

and

{ name : "megsapp-sim-card-process", cwd : "/opt/megsapp-sim-card-process/", script : "node ace", args : "scheduler:run", error_file : "/var/log/megsapp-sim-card-process/error.log", out_file : "/var/log/megsapp-sim-card-process/out.log", }

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

5 participants