JSPM

@mh-cbon/which-service-manager

1.0.4
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q25586F
    • License MIT

    Tells which service manager the system is running

    Package Exports

    • @mh-cbon/which-service-manager

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@mh-cbon/which-service-manager) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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