Files
Tools/pm2/README.md
T

1.1 KiB

PM2 Helpers

Utility scripts for managing PM2 process groups across multiple projects.

Files

  • pm2-manager.sh — Interactive CLI for managing all PM2 services discovered under the parent directory. Supports list, recreate, reload, restart, and delete actions. Operates on ecosystem.config.cjs and ecosystem.cron.config.js files found at depth 2.

  • pm2-recreate.sh — Simple one-shot script to delete and re-create a single PM2 app from its ecosystem file. Useful for picking up .env or config changes.

Usage

# Interactive mode
./pm2-manager.sh

# List discovered services
./pm2-manager.sh list

# Run action by index or name
./pm2-manager.sh restart 1
./pm2-manager.sh reload zap

# Recreate a single app
./pm2-recreate.sh /path/to/project app-name ecosystem.config.cjs

Conventions

Both scripts look for project directories with ecosystem.config.cjs (or ecosystem.cron.config.js) one level below the workspace root. App names are extracted from the ecosystem file's name field, falling back to the directory name.