@rubysown/node-service

0.1.1 • Public • Published

node-service

Node.JS module to help making grab process & service information

Requirements:

  • Linux
  • systemctl

Install

# NPM
npm install --save node-service

# Yarn
yarn add node-service

Use

const nodeService = require('node-service')

// Promise
nodeService.getService('redis')
    .then(res => console.log(res))
    .catch(err => console.error(err))

// Try/catch
try {
    let service = await nodeService.getService('redis')
    console.log(service)
} catch (error) {
    console.error(error)
}

// Different process / service name
nodeService.getService('redis-server', 'redis')
    .then(res => console.log(res))
    .catch(err => console.error(err))

// Different ps arguments (node-service uses `aux` by default)
nodeService.getService('redis-server', 'redis', 'au')
    .then(res => console.log(res))
    .catch(err => console.error(err))

// Set debug value to get more errors
nodeService.DEBUG = true;

Package Sidebar

Install

npm i @rubysown/node-service

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

3.78 kB

Total Files

5

Last publish

Collaborators

  • rubysown