pi@opentrickler:~/projects/trickler/peripheral $ pm2 start ecosystem.config.js ------------- __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____ _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___ _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__ _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___ _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____ _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________ _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________ _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_ _\///______________\///______________\///__\///////////////__ 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] Spawning PM2 daemon with pm2_home=/home/pi/.pm2 [PM2] PM2 Successfully daemonized [PM2][WARN] Applications opentrickler not running, starting... [PM2] App [opentrickler] launched (1 instances) ┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐ │ id │ name │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │ ├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤ │ 0 │ opentrickler │ 1.0.0 │ cluster │ 2903 │ 2s │ 0 │ online │ 0% │ 25.8mb │ pi │ disabled │ └────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘ pi@opentrickler:~/projects/trickler/peripheral $ pm2 startup systemd [PM2] Init System found: systemd [PM2] To setup the Startup Script, copy/paste the following command: sudo env PATH=$PATH:/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/bin /usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi pi@opentrickler:~/projects/trickler/peripheral $ sudo env PATH=$PATH:/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/bin /usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi ------------- __/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____ _\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___ _\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__ _\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___ _\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____ _\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________ _\/\\\_____________\/\\\_____________\/\\\___/\\\/___________ _\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_ _\///______________\///______________\///__\///////////////__ 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=pi LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin Environment=PM2_HOME=/home/pi/.pm2 PIDFile=/home/pi/.pm2/pm2.pid Restart=on-failure ExecStart=/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 resurrect ExecReload=/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 reload all ExecStop=/usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 kill [Install] WantedBy=multi-user.target Target path /etc/systemd/system/pm2-pi.service Command list [ 'systemctl enable pm2-pi' ] [PM2] Writing init configuration in /etc/systemd/system/pm2-pi.service [PM2] Making script booting at startup... [PM2] [-] Executing: systemctl enable pm2-pi... Created symlink /etc/systemd/system/multi-user.target.wants/pm2-pi.service → /etc/systemd/system/pm2-pi.service. [PM2] [v] Command successfully executed. +---------------------------------------+ [PM2] Freeze a process list on reboot via: $ pm2 save [PM2] Remove init script via: $ pm2 unstartup systemd pi@opentrickler:~/projects/trickler/peripheral $ pm2 save [PM2] Saving current process list... [PM2] Successfully saved in /home/pi/.pm2/dump.pm2 pi@opentrickler:~/projects/trickler/peripheral $ sudo systemctl start pm2-pi Job for pm2-pi.service failed because the service did not take the steps required by its unit configuration. See "systemctl status pm2-pi.service" and "journalctl -xe" for details. pi@opentrickler:~/projects/trickler/peripheral $ sudo systemctl start pm2-pi.service Job for pm2-pi.service failed because the service did not take the steps required by its unit configuration. See "systemctl status pm2-pi.service" and "journalctl -xe" for details. pi@opentrickler:~/projects/trickler/peripheral $ systemctl status pm2-pi.service ● pm2-pi.service - PM2 process manager Loaded: loaded (/etc/systemd/system/pm2-pi.service; enabled; vendor preset: enabled) Active: activating (start) since Sat 2019-10-26 07:18:47 BST; 3s ago Docs: https://pm2.keymetrics.io/ Cntrl PID: 3041 (node) Memory: 11.5M CGroup: /system.slice/pm2-pi.service └─3041 node /usr/local/lib/nodejs/node-v8.16.0-linux-armv6l/lib/node_modules/pm2/bin/pm2 resurrect Oct 26 07:18:47 opentrickler systemd[1]: Starting PM2 process manager... pi@opentrickler:~/projects/trickler/peripheral $ journalctl -xe Oct 26 07:19:15 opentrickler pm2[3062]: [PM2] Restoring processes located in /home/pi/.pm2/dump.pm2 Oct 26 07:19:15 opentrickler pm2[3062]: ┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬─────── Oct 26 07:19:15 opentrickler pm2[3062]: │ id │ name │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user Oct 26 07:19:15 opentrickler pm2[3062]: ├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼─────── Oct 26 07:19:15 opentrickler pm2[3062]: │ 0 │ opentrickler │ 1.0.0 │ cluster │ 2903 │ 2m │ 0 │ online │ 0% │ 32.3mb │ pi Oct 26 07:19:15 opentrickler pm2[3062]: └────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴─────── Oct 26 07:19:15 opentrickler systemd[1]: pm2-pi.service: Can't open PID file /home/pi/.pm2/pm2.pid (yet?) after start: No such file or directory Oct 26 07:19:15 opentrickler systemd[1]: pm2-pi.service: Failed with result 'protocol'. -- Subject: Unit failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- The unit pm2-pi.service has entered the 'failed' state with result 'protocol'. Oct 26 07:19:15 opentrickler systemd[1]: Failed to start PM2 process manager. -- Subject: A start job for unit pm2-pi.service has failed -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A start job for unit pm2-pi.service has finished with a failure. -- -- The job identifier is 1123 and the job result is failed. Oct 26 07:19:16 opentrickler systemd[1]: pm2-pi.service: Service RestartSec=100ms expired, scheduling restart. Oct 26 07:19:16 opentrickler systemd[1]: pm2-pi.service: Scheduled restart job, restart counter is at 11. -- Subject: Automatic restarting of a unit has been scheduled -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- Automatic restarting of the unit pm2-pi.service has been scheduled, as the result for -- the configured Restart= setting for the unit. Oct 26 07:19:16 opentrickler systemd[1]: Stopped PM2 process manager. -- Subject: A stop job for unit pm2-pi.service has finished -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A stop job for unit pm2-pi.service has finished. -- -- The job identifier is 1179 and the job result is done. Oct 26 07:19:16 opentrickler systemd[1]: Starting PM2 process manager... -- Subject: A start job for unit pm2-pi.service has begun execution -- Defined-By: systemd -- Support: https://www.debian.org/support -- -- A start job for unit pm2-pi.service has begun execution. -- -- The job identifier is 1179. lines 2099-2142/2142 (END)