Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

barely-pm2

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barely-pm2

High level PM2 wrapper for nodejs

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
68
decreased by-68.08%
Maintainers
0
Weekly downloads
 
Created
Source

Barely-PM2

This module provides a simple interface to manage processes using PM2 (Process Manager 2) in Node.js applications. It allows you to create, start, stop, list, and delete processes with ease.

Installation

npm i barely-pm2

Usage

You can require this module in your Node.js / Bare application and use the provided functions to manage your PM2 processes.

const { PM2list, PM2delete, PM2stop, PM2start, PM2create } = require('./path-to-your-module');

API

PM2list(opts = {})

Lists all PM2 processes.

  • opts.color: (boolean) Optional. If set to true, forces color output in the console.
  • opts.raw: (boolean) Optional. Don't use PM2 binary if set to false.
  • opts.name: (string) Optional. List only the processes string with the name.

PM2delete(processName, exit)

Deletes a specified PM2 process.

  • processName: (string) The name of the process to delete.
  • exit: (boolean) Exit the process after completion.

PM2stop(processName, exit)

Stops a specified PM2 process.

  • processName: (string) The name of the process to stop.
  • exit: (boolean) Exit the process after completion.

PM2start(processName, exit)

Starts a specified PM2 process.

  • processName: (string) The name of the process to start.
  • exit: (boolean) Exit the process after completion.

PM2create(opts = {})

Creates and starts a new PM2 process.

  • opts.name: (string) Optional. Custom name for the process. If not provided, a unique timestamped name will be used.
  • opts.script: (string) The script to run.
  • opts.args: (string) Arguments to pass to the script.
  • opts.timeout: (number) Optional. Timeout in milliseconds after which PM2 will disconnect.

PM2logs(processName)

Display logs for the process

  • processName: (string) The name of the process to view logs for.

Example

Here’s an example of how to use the module:

const { PM2list, PM2delete, PM2stop, PM2start, PM2create } = require('./');

PM2create({ name: 'New script', script: '/path/to/script', args: "--host localhost", timeout: 5000 });

PM2list({ color: false });

PM2stop('New script');

PM2start('New script');

PM2delete('New script');

License

This module is licensed under the GPL-3.0 License. See the LICENSE file for more information.

Keywords

FAQs

Package last updated on 30 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc