npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

@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

install

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

Downloadsweekly downloads

4

version

1.0.4

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability