I'm running pm2 with this:
pm2 start bin/www --watch ../
Problem is that when I update app.js in the root folder, it doesn't seem to be autorestarting node. Any ideas?
I'm running pm2 with this:
pm2 start bin/www --watch ../
Problem is that when I update app.js in the root folder, it doesn't seem to be autorestarting node. Any ideas?
Figured out a solution:
//processes.json:
{
"apps" : [{
"name" : "someExpress4App",
"script" : "bin/www",
"watch" : "../",
"log_date_format" : "YYYY-MM-DD HH:mm Z",
}]
}
Put that on the root of your project, then run your pm2 as so:
pm2 start processes.json
"watch": ['core', 'other-folder', 'app.js']
–
Sideline "ignore_watch" : [".idea"]
if you know exactly what's going to be constantly refreshed. –
Scot { "apps":[ { "name":"fp-back", "script":"/opt/nodeJs/fp-back/bin/www", "log_file":"/var/log/pm2/fp-back.log", "error_file":"/bar/log/pm2/fp-back-err.log", "watch":"/opt/nodeJs/fp-back/" } ] }
what thing i am doing wrong i triple check this file –
Pinter © 2022 - 2024 — McMap. All rights reserved.
--watch ../
, you're actually specifying the folder above where you actually want to watch. I haven't tried it myself, since I'm usingpm2
on a production server, so I end upssh
ing in,git pull
ing the latest code, and then runningpm2 restart www
manually, which doesn't pertain to your problem. – Tremolant