My ecosystem.config.js file loads my environment great with this command:
pm2 start ecosystem.config.js
When I run any of these command, my environment is reloaded just fine:
pm2 reload myapp
pm2 restart myapp
pm2 reload ecosystem.config.js
pm2 restart ecosystem.config.js
Then I try to make sure I get my environment back after a reboot. If I run pm2 startup
I get this:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u me --hp /home/me
After running that command, I can reboot my machine and my application is restarted automatically. However, I am missing my environment from the ecosystem.config.js
file. Why? How do I make sure the environment from my ecosystem.config.js
environment is loaded when the machine is rebooted? Thanks.
PM2 is designed to work with the default init system on a Linux system (which it can auto-detect) to generate the startup script and configure PM2 as a service that can be restarted at system boot. The startup sub-command tells PM2 to detect available init system, generate configuration and enable the startup system.
The default configuration file is ecosystem. core3. config. js , and is located in the root folder of lisk-service : It contains a configuration to connect to a local Lisk Core node.
PM2 allows to reload (auto fallback to restart if not in cluster) an application based on a memory limit/ Please note that the PM2 internal worker (which checks memory), starts every 30 seconds, so you may have to wait a bit before your process gets restarted automatically after reaching the memory threshold.
Dont forget to save your config! pm2 save
In case you want pm2 on startup with changed logs path:
pm2 delete all
pm2 start ecosystem.js
pm2 save
pm2 startup
I had the same issue. After executing the command suggested by pm2 startup
, I found I had to first run pm2 delete all
, then restart using pm2 start ecosystem.config.js
. My environment is now loading as expected after rebooting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With