anhnongdan / bimax_ha_migration

all db backup, recovery and migration scenarios for bimax
0 stars 0 forks source link

Can't list PM2 processes ran from Supervisor #16

Open anhnongdan opened 6 years ago

anhnongdan commented 6 years ago

Unitech/pm2#2962

There're 2 PM2 daemons:

[root@VNPT-HCM-BIMAX-02 ha]# ps -ef | grep pm2 root 4832 1 0 23:36 ? 00:00:00 PM2 v2.6.1: God Daemon (/root/.pm2) root 5704 1 0 23:36 ? 00:00:01 PM2: KM Agent (/root/.pm2) root 6590 7738 0 23:41 pts/0 00:00:00 grep --color=auto pm2 root 22478 1 0 23:06 ? 00:00:06 PM2 v2.6.1: God Daemon (/etc/.pm2)

anhnongdan commented 6 years ago

Turned out that supervisor uses PM2 Home as /etc/.pm2

[root@VNPT-HCM-BIMAX-02 ~]# export PM2_HOME=/etc/.pm2
[root@VNPT-HCM-BIMAX-02 ~]#
[root@VNPT-HCM-BIMAX-02 ~]#
[root@VNPT-HCM-BIMAX-02 ~]#
[root@VNPT-HCM-BIMAX-02 ~]# pm2 l
┌──────────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬──────────┬──────┬──────────┐
│ App name     │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem      │ user │ watching │
├──────────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼──────────┼──────┼──────────┤
│ extract_4001 │ 0  │ fork │ 32232 │ online │ 1       │ 31m    │ 0%  │ 1.4 MB   │ root │ disabled │
│ extract_4002 │ 1  │ fork │ 18571 │ online │ 0       │ 37m    │ 0%  │ 1.4 MB   │ root │ disabled │
│ extract_4003 │ 2  │ fork │ 27058 │ online │ 1       │ 30m    │ 0%  │ 1.4 MB   │ root │ disabled │
│ extract_4005 │ 3  │ fork │ 21718 │ online │ 0       │ 37m    │ 0%  │ 1.2 MB   │ root │ disabled │
│ extract_4006 │ 4  │ fork │ 24052 │ online │ 0       │ 37m    │ 0%  │ 1.2 MB   │ root │ disabled │
└──────────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴──────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
[root@VNPT-HCM-BIMAX-02 ~]# pm2 stop all
[PM2] Applying action stopProcessId on app [all](ids: 0,1,2,3,4)
[PM2] [extract_4001](0) ✓
[PM2] [extract_4003](2) ✓
[PM2] [extract_4005](3) ✓
[PM2] [extract_4006](4) ✓
[PM2] [extract_4002](1) ✓
┌──────────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬──────┬──────────┐
│ App name     │ id │ mode │ pid │ status  │ restart │ uptime │ cpu │ mem    │ user │ watching │
├──────────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼──────┼──────────┤
│ extract_4001 │ 0  │ fork │ 0   │ stopped │ 1       │ 0      │ 0%  │ 0 B    │ root │ disabled │
│ extract_4002 │ 1  │ fork │ 0   │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ root │ disabled │
│ extract_4003 │ 2  │ fork │ 0   │ stopped │ 1       │ 0      │ 0%  │ 0 B    │ root │ disabled │
│ extract_4005 │ 3  │ fork │ 0   │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ root │ disabled │
│ extract_4006 │ 4  │ fork │ 0   │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ root │ disabled │
└──────────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴──────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
[root@VNPT-HCM-BIMAX-02 ~]#
anhnongdan commented 6 years ago

Accept this env for now.