Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable/stop a pm2 module?

Is it possible to stop or disable a pm2 module ? I did install the pm2-logrotate module but recently the community found an issue which is affecting our services and we need to stop or disable the module in top priority.

The module is continuously restarting and the node application in is production. So we cannot just stop the pm2 and look for a fix.

nodejs version: "4.8.2"
pm2 version "2.7.2"
pm2-logrotate version "2.4.0"
OS-Release: "Raspbian Stretch"


$ pm2 describe pm2-logrotate | grep -i script
│ script path       │ /home/user/.pm2/node_modules/pm2-logrotate/app.js │
│ script args       │ N/A                                                     │
│ script id         │ 0                                                       │
$ pm2 describe pm2-logrotate | grep -i id
 Describing process with id 0 - name pm2-logrotate
│ pid path          │ /home/user/.pm2/pids/pm2-logrotate-0.pid          │
│ script id         │ 0                                                       │
$ cat /home/user/.pm2/pids/pm2-logrotate-0.pid
7723
like image 572
negrotico19 Avatar asked Apr 16 '18 00:04

negrotico19


People also ask

How do you stop a pm2 process?

How to disable monitoring for a specific process? You can then use the command `pm2 unmonitor [APP_NAME|ID]` to stop monitoring a process with PM2 Plus. `pm2 ls` will display a red dot indicating the application will not be monitored by PM2 Plus. If you want to monitor the process again use `pm2 monitor [APP_NAME|ID]`.

How do I start a pm2 module?

Installation. pm2 install <module-name> # Install a module from GitHub (username/repository) pm2 install pm2-hive/pm2-docker # Install a module in dev mode from local folder pm2 install .

How do I restart pm2?

Restart on file change To totally disable the watch feature, do: pm2 stop app --watch or toggle the watch option on application restart via pm2 restart app --watch .


1 Answers

You can do pm2 describe pm2-logrotate. This will return alot of information. What you are looking for is script id

│ interpreter       │ node
│ interpreter args  │ N/A
│ script id         │ 0     
│ exec cwd          │ /home/user/.pm2/modules/pm2-logrotate/node_modules/pm2-logrotate
│ exec mode         │ fork_mode 
│ node.js version   │ 8.11.1

Now you know that the AppId is 0 so you can do

pm2 stop 0

and the module will stop.

You can always uninstall using

pm2 uninstall pm2-logrotate

like image 109
Stamos Avatar answered Oct 28 '22 07:10

Stamos