Skip to content

pm2 not resurrecting after reboot - Linux Mint, pm2 3.2.2 #4030

@jcollum

Description

@jcollum

Same machine as this issue: #3635, new version of pm2 has same issue.

PM2 is not restarting a saved process after a reboot.

$ pm2 --version
3.2.2

$ pm2 start /home/justin/mining/eth.sh
[PM2] Starting /home/justin/mining/eth.sh in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬─────┬──────────┬────────┬──────────┐
│ App name │ id │ version │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem      │ user   │ watching │
├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼─────┼──────────┼────────┼──────────┤
│ eth      │ 0  │ N/A     │ fork │ 9748 │ online │ 0       │ 0s     │ 0%  │ 3.0 MB   │ justin │ disabled │
└──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴─────┴──────────┴────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app


$ pm2 startup
[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/home/justin/.nvm/versions/node/v10.13.0/bin /home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/bin/pm2 startup systemd -u justin --hp /home/justin


$ sudo env PATH=$PATH:/home/justin/.nvm/versions/node/v10.13.0/bin /home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/bin/pm2 startup systemd -u justin --hp /home/justin
[sudo] password for justin:
Sorry, try again.
[sudo] password for justin:
[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=justin
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/home/justin/.nvm/versions/node/v10.13.0/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/home/justin/.pm2
PIDFile=/home/justin/.pm2/pm2.pid

ExecStart=/home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/bin/pm2 resurrect
ExecReload=/home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/bin/pm2 reload all
ExecStop=/home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target

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

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


$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /opt/.pm2/dump.pm2

$ sudo reboot

#
#
# MACHINE REBOOTS
#
#

$ pm2 ls
[PM2] Spawning PM2 daemon with pm2_home=/opt/.pm2
[PM2] PM2 Successfully daemonized
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app


$ pm2 report
===============================================================================
--- PM2 REPORT (Sat Nov 17 2018 14:13:07 GMT-0800 (Pacific Standard Time)) ----
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.2.2
node version         : 10.13.0
node path            : /home/justin/.nvm/versions/node/v10.13.0/bin/pm2
argv                 : /home/justin/.nvm/versions/node/v10.13.0/bin/node,/home/justin/.nvm/versions/node/v10.13.0/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : justin
uid                  : 1000
gid                  : 1000
uptime               : 3min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.2.2
node version         : 10.13.0
node path            : /home/justin/.nvm/versions/node/v10.13.0/bin/pm2
argv                 : /home/justin/.nvm/versions/node/v10.13.0/bin/node,/home/justin/.nvm/versions/node/v10.13.0/bin/pm2,report
argv0                : node
user                 : justin
uid                  : 1000
gid                  : 1000
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
cpus nb              : 2
freemem              : 7672913920
totalmem             : 8370278400
home                 : /home/justin
===============================================================================
--- PM2 list -----------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
┌──────────┬────┬─────────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────┬──────────┐
│ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
└──────────┴────┴─────────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

$ node --version
v10.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions