A stopped process doesn't watch anymore, if restarted
I have the following config file:
` {
"apps": [
{
"name": "Repository",
"script": "./bin/server.js",
"exec_mode": "fork",
"watch": "./restart_node",
"watch_options": {
"usePolling": true
},
"log_date_format": "YYYY-MM-DD HH:mm:ssZ",
"error_file": "./logs/error.log",
"out_file": "./logs/out.log",
"merge_logs": true
}
]
} `
Now i start the process like this:
pm2 start pm2.config.json
i get the following output:
[Watch] Start watching 45
Now i stop the process:
pm2 stop 45
This is the output:
[Watch] Stop watching 45
After i start again like above, there is no output which shows me, that watching is enabled and it doesn't watch anymore on my file. I also tried the restart command after stopping:
pm2 restart 45
which also didn't work. Is there anything more to do?
Same problem here.
Just to mention that this problem only appears when I use a config file to launch my processes.
If I just type pm2 start dist/bundle.js --watch then pm2 stop bundle then again pm2 start dist/bundle.js --watch the watching feature works as expected.
~~It also fails if I try to run it through a package.json script instruction as follow:
"scripts": { "start": "pm2 start dist/bundle.js" }~~
EDITED: I obviously forgot to add the --watch option to my package.json script. It works as expected when launched from a npm script.
Merging with https://github.com/Unitech/pm2/issues/2629
It's still not working? :-1:
+1 i restart config.js not working
Same here. The only way I can stop and start a process and have it watch is to delete the process, then start a completely new one...
Can this task be reopened? This is still happening in version 3.3.1
This is still an issue. Even after I have deleted the process and restart it did not watch files and refer to old values from the file being watched. pm2 version 4.4.1