Skip to content

Instantly share code, notes, and snippets.

@intelguasoft
Created April 23, 2020 23:12
Show Gist options
  • Save intelguasoft/b23990f4ee440f4b20a299942dc74353 to your computer and use it in GitHub Desktop.
Save intelguasoft/b23990f4ee440f4b20a299942dc74353 to your computer and use it in GitHub Desktop.
                    -------------

/\\\\\\_/\\/\\/\\\\_ _/\/////////\_/\\\/\\\/\///////\_ /\_/\_/\//\_/\//\_/////\_ _/\\\\\\//\\///\/\//\_/\/ /\//////////\_///\//\_/\//_____ /\_/\_////\_____/\//_____ /\_/\_/\_/\/__________ /\_/\_/\_/\\\\\\\_ _////////////////////////

                      Runtime Edition

    PM2 is a Production Process Manager for Node.js applications
                 with a built-in Load Balancer.

            Start and Daemonize any application:
            $ pm2 start app.js

            Load Balance 4 instances of api.js:
            $ pm2 start api.js -i 4

            Monitor in production:
            $ pm2 monitor

            Make pm2 auto-boot at server restart:
            $ pm2 startup

            To go further checkout:
            http://pm2.io/


                    -------------

[PM2] Init System found: systemd Platform systemd Template [Unit] Description=PM2 process manager Documentation=https://pm2.keymetrics.io/ After=network.target

[Service] Type=forking User=safeuser LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin Environment=PM2_HOME=/home/realsoft_dev/.pm2 PIDFile=/home/realsoft_dev/.pm2/pm2.pid Restart=on-failure

ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect ExecReload=/usr/lib/node_modules/pm2/bin/pm2 reload all ExecStop=/usr/lib/node_modules/pm2/bin/pm2 kill

[Install] WantedBy=multi-user.target

Target path /etc/systemd/system/pm2-safeuser.service Command list [ 'systemctl enable pm2-safeuser' ] [PM2] Writing init configuration in /etc/systemd/system/pm2-safeuser.service [PM2] Making script booting at startup... [PM2] [-] Executing: systemctl enable pm2-safeuser... Created symlink /etc/systemd/system/multi-user.target.wants/pm2-safeuser.service → /etc/systemd/system/pm2-safeuser.service. [PM2] [v] Command successfully executed. +---------------------------------------+ [PM2] Freeze a process list on reboot via: $ pm2 save

[PM2] Remove init script via: $ pm2 unstartup systemd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment