Skip to main content

Node.js / PM2 operations

v0.1.8

PM2 process inventory + logs + per-app introspection, plus narrow mutators (restart, reload, stop, scale). Requires the runner to be the same uid as the PM2 daemon (or set PM2_HOME).

11 allowed by default 4 need approval by default
Pack ID
nodejs-pm2
Vendor
emisar
OS
linux
Actions
15
Required binaries. Install these on the host before relying on the pack — an action that calls a missing one fails at run time.
pm2 jq

Install

emisar pack install fetches this pack, re-validates it, and verifies its content hash against the --hash below — the exact bytes this page was rendered against, so a tampered copy is rejected — before copying it into the runner's packs dir. The command reloads a running daemon itself; no manual restart.

on the runner host
sudo emisar pack install nodejs-pm2 --hash sha256:f43db76d5116931f4ab34eff4d0e83a80862f9f747277d64829450dd7af909d2

Actions 15 total

View on GitHub
  • pm2.describe exec low

    pm2 describe <name>

    Show config + runtime details for one process (status, restarts, uptime, script path, resources). Read-only. Per-process environment is projected out — use `pm2.env` for one process's effective env.

    View source on GitHub
  • pm2.dump exec medium

    pm2 dump

    Persists the current process list so PM2 resurrects it on boot.

    View source on GitHub
  • pm2.env exec medium

    pm2 env <id>

    Show effective environment for one process (post-merge of system + app env).

    View source on GitHub
  • pm2.error_logs exec low

    pm2 logs <name> --err --lines N --nostream

    Tails the last N stderr-only lines for one process.

    View source on GitHub
  • pm2.flush_logs exec medium

    pm2 flush <name>

    Empties PM2 log files for one process. Existing log content is lost.

    View source on GitHub
  • pm2.jlist exec low

    pm2 jlist

    List PM2 processes as JSON with status, uptime, restarts, mode, and CPU/mem. Read-only. Per-process environment is projected out — use `pm2.env` for one process's effective env.

    View source on GitHub
  • pm2.list exec low

    pm2 list

    List all processes managed by PM2 with status, uptime, restarts, CPU/mem.

    View source on GitHub
  • pm2.logs exec low

    pm2 logs <name> --lines N --nostream

    Tails the last N stdout+stderr lines for one process.

    View source on GitHub
  • pm2.monit_snapshot exec low

    pm2 monit snapshot (CPU + memory)

    Show one-shot CPU + memory snapshot for every process as JSON. Read-only. Per-process environment is projected out — use `pm2.env` for one process's effective env.

    View source on GitHub
  • pm2.node_version exec low

    node --version

    Show Node.js runtime version (system default).

    View source on GitHub
  • pm2.pm2_version exec low

    pm2 -v

    Show PM2 daemon version.

    View source on GitHub
  • pm2.reload exec high

    pm2 reload <name>

    Zero-downtime reload — only safe for cluster-mode apps. For fork-mode, behaves like restart.

    View source on GitHub
  • pm2.restart exec high

    pm2 restart <name>

    Hard-restarts one process (kill + spawn). Drops in-flight requests.

    View source on GitHub
  • pm2.scale exec high

    pm2 scale <name> <N>

    Sets the number of cluster-mode workers for one app. No-op for fork mode.

    View source on GitHub
  • pm2.stop exec high

    pm2 stop <name>

    Stops one process (PM2 won't auto-restart until you `start`/`restart`).

    View source on GitHub