PM2 is a production process manager for Node.js applications. When you start a Node.js application with PM2, you can pass it parameters to configure its behavior. Some common PM2 startup parameters include

  • --name or -n: Specify the process name to be started by PM2.
  • --watch or -w: Watch for file changes and restart the process if any changes are detected.
  • --ignore-watch or -i: list of file patterns to ignore when using the --watch option.
  • --max-memory-restart: The maximum amount of memory (in MB) that a process is allowed to consume before being restarted.
  • --output or -o: path to stdout log file.
  • --error or -e: path to stderr log file.
  • --env or -x: The environment in which the process runs.

Here's an example of starting a Node.js application with PM2 and passing some parameters:

pm2 start app.js --name "my-app" --watch --ignore-watch="data/*" --max-memory-restart 200M --env production

Note that these are just a few of the many options available when launching processes with PM2. For more information and a complete list of options, you can refer to the PM2 documentation.

Likes(0)

Comment list count 0 Comments

No Comments