Restart application on changes

It’s pretty easy with the --watch option

$ cd /path/to/my/app
$ pm2 start env.js --watch --ignore-watch="node\_modules"

This will watch & restart the app on any file change from the current directory + all subfolders and it will ignore any changes in the node_modules folder --ignore-watch="node_modules".

You can then use pm2 logs to check for restarted app logs.

Comments