如何在node中获取pm2参数

如何在node中获取pm2参数

pm2会自动在process.env 设置一些参数,比如process.env.name 就是pm2启动的appname

其他参数参考如下:

{ YARN_VERSION: '1.6.0',

HOSTNAME: '952779b5ff4e',

PWD: '/app/yunsiweiservice',

HOME: '/root',

NODE_VERSION: '10.1.0',

'affinity:container': '=bd260641c08bb00736d69b225ec0977ddf3fbed3604bda36d593e2eb29890469',

TERM: 'xterm',

SHLVL: '1',

PATH: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',

_: '/usr/local/bin/pm2',

PM2_USAGE: 'CLI',

PM2_HOME: '/root/.pm2',

SILENT: 'true',

windowsHide: 'true',

username: 'root',

instance_var: 'NODE_APP_INSTANCE',

exec_mode: 'cluster_mode',

watch: 'false',

treekill: 'true',

autorestart: 'true',

automation: 'true',

pmx: 'true',

vizion: 'true',

instances: '1',

name: 'yunsiweiservice',

args: '-f,-P,8052,-p,/app/yunsiweiservice',

node_args: '',

pm_exec_path: '/usr/local/lib/node_modules/visop/bin/visop-start',

env: '[object Object]',

pm_cwd: '/app/yunsiweiservice',

exec_interpreter: 'node',

pm_out_log_path: '/root/.pm2/logs/yunsiweiservice-out-11.log',

pm_err_log_path: '/root/.pm2/logs/yunsiweiservice-error-11.log',

pm_pid_path: '/root/.pm2/pids/yunsiweiservice-11.pid',

km_link: 'false',

vizion_running: 'false',

NODE_APP_INSTANCE: '0',

status: 'launching',

pm_uptime: '1529724769233',

axm_actions: '',

axm_monitor: '[object Object]',

axm_options: '[object Object]',

axm_dynamic: '[object Object]',

created_at: '1529724769233',

pm_id: '11',

restart_time: '0',

unstable_restarts: '0',

_pm2_version: '2.10.4' }

你可能感兴趣的:(如何在node中获取pm2参数)