# @keeex/pm2-status

> Check some PM2 attributes from environment variables

Latest version **1.1.1** (published 2026-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @keeex/pm2-status
pnpm add @keeex/pm2-status
yarn add @keeex/pm2-status
bun add @keeex/pm2-status
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2026-09-25 |
| First published | 2021-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | KeeeX SAS |
| Maintainers | marc-keeex, cley_faye, keeex_jenkins |
| Keywords | pm2, log, environment, variable |

## Links

- npm: https://www.npmjs.com/package/@keeex/pm2-status
- Repository: https://forge.keeex.net:KeeeX/lib_node_pm2-status
- Homepage: https://forge.keeex.net/KeeeX/lib_node_pm2-status
- Issues: https://forge.keeex.net/KeeeX/lib_node_pm2-status/issues
- npm.io page: https://npm.io/package/@keeex/pm2-status

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2026-09-25
- 1.0.2 — 2026-06-24
- 1.0.0 — 2021-05-17

## README

# `@keeex/pm2-status`

Detect if the current process is running under PM2 and provide some settings from it.

This library provides four functions:

- `isPM2()`: return true if running under PM2
- `getInstanceId()`: return the identifier of the current instance, or `undefined` if
  not applicable.
- `isLogTimestamped()`: return true if running under PM2 and log timestamp is enabled
- `disconnectPm2()`: disconnect from PM2 (safe to call in any case)

## Installation

Install from `npmjs`:

```shell
npm install @keeex/pm2-status
```

## Usage

Import named functions from default export

```JavaScript
import {isPM2, disconnectPm2} from "@keeex/pm2-status";

if (isPM2()) {
  console.log("Yep, under PM2");
}
```

## Disconnecting from PM2

When your process is managed by PM2, you should call `disconnectPm2()` at the end of all processes that could be run under PM2. This function safely disconnects from PM2 and can be called in any case, even when not running under PM2.

```JavaScript
// Call this when your process is done
disconnectPm2();
```

---
_Source: https://npm.io/package/@keeex/pm2-status · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
