Ubuntu 14.04 - pm2 startup not starting after reboot

前端 未结 5 1948
南旧
南旧 2021-01-02 13:04

I am using pm2 to start a node.js process, and I would like this process to be started automatically when the system (Ubuntu 14.04 on Intel Atom processor) is booted. I have

5条回答
  •  独厮守ぢ
    2021-01-02 13:46

    What steps work for me on Ubuntu 18.04.4

    1. npm i pm2 -g
    2. run this command as root user: pm2 startup
      • creates service pm2-root found in /etc/systemd/system
    3. systemctl enable pm2-root, service pm2-root status
      • Note: after Node upgrade, run these commands as root: pm2 unstartup, pm2 startup; documentation
    4. pm2 start dist\index.js --name YourNodeApp
    5. pm2 save
    6. reboot
    7. pm2 ls should show your YourNodeApp online

提交回复
热议问题