pm2
pm2 copied to clipboard
`pm2 startup` does not take environment variable `PM2_HOME` into account
What's going wrong?
When I set PM2_HOME
environment variable, the systemd unit file generated by pm2 startup
is expected to use the value of PM2_HOME
. But it still generates the following without considering my custom value of PM2_HOME
Environment=PM2_HOME=<my home>/.pm2
PIDFile=<my home>/.pm2/pm2.pid
How could we reproduce this issue?
export PM2_HOME="/some/new/path"
pm2 startup # Add --preserve-env='PM2_HOME' to generated sudo command
systemctl cat pm2-$(id -nu).service
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Thu Jun 20 2024 22:02:07 GMT+0800 (China Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.4.0
node version : 22.3.0
node path : /fhome/fuxd/.nvm/versions/node/v22.3.0/bin/pm2
argv : /fhome/fuxd/.nvm/versions/node/v22.3.0/bin/node,/fhome/fuxd/.nvm/versions/node/v22.3.0/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : fuxd
uid : 2002
gid : 2002
uptime : 14min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.4.0
node version : 22.3.0
node path : /fhome/fuxd/.nvm/versions/node/v22.3.0/bin/pm2
argv : /fhome/fuxd/.nvm/versions/node/v22.3.0/bin/node,/fhome/fuxd/.nvm/versions/node/v22.3.0/bin/pm2,report
argv0 : node
user : fuxd
uid : 2002
gid : 2002
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz
cpus nb : 80
freemem : 1029278760960
totalmem : 1081532235776
home : /fhome/fuxd
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬───────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼───────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ data360-check2 │ default │ N/A │ fork │ 2301770 │ 14m │ 0 │ online │ 0% │ 3.3mb │ fuxd │ disabled │
└────┴───────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/fhome/fuxd/.pm2/sy03/pm2.log last 20 lines:
PM2 | 2024-06-20T21:47:50: PM2 log: ===============================================================================
PM2 | 2024-06-20T21:47:50: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2 | 2024-06-20T21:47:50: PM2 log: Time : Thu Jun 20 2024 21:47:50 GMT+0800 (China Standard Time)
PM2 | 2024-06-20T21:47:50: PM2 log: PM2 version : 5.4.0
PM2 | 2024-06-20T21:47:50: PM2 log: Node.js version : 22.3.0
PM2 | 2024-06-20T21:47:50: PM2 log: Current arch : x64
PM2 | 2024-06-20T21:47:50: PM2 log: PM2 home : /fhome/fuxd/.pm2/sy03
PM2 | 2024-06-20T21:47:50: PM2 log: PM2 PID file : /fhome/fuxd/.pm2/sy03/pm2.pid
PM2 | 2024-06-20T21:47:50: PM2 log: RPC socket file : /fhome/fuxd/.pm2/sy03/rpc.sock
PM2 | 2024-06-20T21:47:50: PM2 log: BUS socket file : /fhome/fuxd/.pm2/sy03/pub.sock
PM2 | 2024-06-20T21:47:50: PM2 log: Application log path : /fhome/fuxd/.pm2/sy03/logs
PM2 | 2024-06-20T21:47:50: PM2 log: Worker Interval : 30000
PM2 | 2024-06-20T21:47:50: PM2 log: Process dump file : /fhome/fuxd/.pm2/sy03/dump.pm2
PM2 | 2024-06-20T21:47:50: PM2 log: Concurrent actions : 2
PM2 | 2024-06-20T21:47:50: PM2 log: SIGTERM timeout : 1600
PM2 | 2024-06-20T21:47:50: PM2 log: ===============================================================================
PM2 | 2024-06-20T21:48:04: PM2 log: App [data360-check2:0] starting in -fork mode-
PM2 | 2024-06-20T21:48:04: PM2 log: App [data360-check2:0] online