@mh-cbon/which-service-manager

1.0.4 • Public • Published

which-service-manager

Tells the service manager running on the current system.

Install

npm i @mh-cbon/which-service-manager --save

Usage

// print list of identifiable service manager
console.log(require('@mh-cbon/which-service-manager').sysInits);
  // serviceManager is one of
  // - systemd
  // - upstart
  // - chkconfig
  // - launchd
  // - sc
  // - sysv

// get current system manager
require('@mh-cbon/which-service-manager')(function (err, serviceManager, bin) {
  err && console.error(err);
  !err && console.log("System found is %s", serviceManager);
  !err && bin && console.log("It provides a binary path %s", bin);
})

// get all system manager running on the system
require('@mh-cbon/which-service-manager').all(function (err, sysInits) {
  err && console.error(err);
  !err && console.log("Init systems found are %j", sysInits);
  Object.keys(sysInits).forEach(function (system) {
    !err && bin && console.log("It provides %s a binary path %s", system.sys, system.path);
  })
})

Todos

  • add openrc support (gentoo)

Read more

Package Sidebar

Install

npm i @mh-cbon/which-service-manager

Weekly Downloads

1

Version

1.0.4

License

MIT

Last publish

Collaborators

  • mh-cbon