0.1.1 • Published 3 years ago

@rubysown/node-service v0.1.1

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

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;