Open realsetvin opened 1 month ago
I took a quick look at this but unfortunately doesn't seem trivial to do. If you want to experiment with this yourself the full cmd that gets run when starting pm2 is:
cd /path/to/explorer && export NODE_ENV=production && ./node_modules/pm2/bin/pm2 start ./bin/instance -i 0 -n explorer -p "./tmp/pm2.pid" --node-args="--stack-size=10000" --update-env
I actually didn't try systemd but tried to add a crontab and it doesn't seem to work as expected. When you run the cmd manually it works although it breaks pm2 if you try to use npm run start-pm2
afterwards which requires a reboot to fix and it will get reinstalled again after running npm run start-pm2
which does some extra processing to check and install pm2 again if not found.
For now, this isn't supported and would likely require some rewrites to the prestart.js to pass in the full pm2 path at the very least.
I'll have to look at this sometime in the future, but it's very low priority on my list since it's easy enough to start it manually and I typically don't reboot my production machine.
If you plan to look at it yourself, let us know if you are successful and I can add a note in the README on how it can be done for those that are interested.
That looks promising thank you very much for the lead, if I get it working I will report here.
Are you using cronjob instead?
Are you using cronjob instead?
I'm only using crontab for running the sync scripts, not for starting the webserver. I just manually start the webserver after a reboot if need be. It's never been an issue for me.
what would be the correct method to start "npm run start-pm2" on linux using systemd? Thank you.