包详细信息

strong-service-install

strongloop606Artistic-2.02.0.3

Install a module as an OS service

upstart, service

自述文件

strong-service-install

Create/install system service for a given app.

Currently only supports Upstart (strong-service-upstart) and systemd (strong-service-systemd).

Installation

npm install strong-service-install

Usage

var installer = require('strong-service-install');

var opts = {
  name: 'my-app',
  author: require('package.json').author,
  user: process.env.USER,
  command: 'my-app --with args --that work',
  cwd: process.env.HOME,
};

installer(opts, function(err, result) {
  if (err) {
    console.error('Failed to install "my-app" service:', err.message);
    process.exit(1);
  } else {
    console.log('Successfully installed "my-app" service:', result);
    process.exit(0);
  }
});

CLI

There is a minimal CLI that exposes the API options as arguments:

usage: sl-svc-install [options] -- <app and args>

Options:
  -h,--help        Print this message and exit.
  --name NAME      Name to use for service (default derived from app)
  --user USER      User to run service as.
  --group GROUP    Group to run service as.
  --jobFile PATH   Upstart file to create (default /etc/init/<name>.conf)
  --cwd PATH       Directory to run the service from.
  --upstart [VER]  Generate Upstart job for VER: 0.6 or 1.4 (default)
  --systemd        Generate systemd service

更新日志

2016-05-06, Version 2.0.3

  • update copyright notices and license (Ryan Graham)

2016-04-11, Version 2.0.2

  • ensure user HOME directory exists (Ryan Graham)

  • Refer to licenses with a link (Sam Roberts)

2015-10-01, Version 2.0.1

  • Use strongloop conventions for licensing (Sam Roberts)

2015-07-13, Version 2.0.0

  • move chown phase to after preWrite hook (Ryan Graham)

  • fix HOME env not being set (Ryan Graham)

  • don't provide default userGroup until it is known (Ryan Graham)

  • generate job file just before writing it (Ryan Graham)

  • package: bump prerelease (Ryan Graham)

  • replace passwd-user dependency (Ryan Graham)

  • autocreate users and paths as needed (Ryan Graham)

  • fix minor lint errors and add systemd to readme (Ryan Graham)

  • lint: add eslint and jscs (Ryan Graham)

  • test: cleanup vagrant tests (Ryan Graham)

  • cli: cleanup -h/--help and add -v/--version (Ryan Graham)

  • test: upgrade to tap@1, add coverage (Ryan Graham)

2015-06-03, Version 1.1.3

  • test: use official tap (Ryan Graham)

2015-01-12, Version 1.1.2

  • Fix bad CLA URL in CONTRIBUTING.md (Ryan Graham)

  • test: update boxes for Vagrant based tests (Ryan Graham)

  • test: use 127.0.0.1 instead of localhost (Ryan Graham)

2014-12-12, Version 1.1.1

  • package: use debug v2.x in all strongloop deps (Sam Roberts)

2014-11-12, Version 1.1.0

  • Add support for installing systemd services (Ryan Graham)

2014-11-03, Version 1.0.1

  • doc: replace --version with --upstart (Ryan Graham)

2014-10-16, Version 1.0.0

  • Bump strong-service-upstart dependency (Ryan Graham)

  • Change --version to --upstart (Ryan Graham)

  • Fix handling of execpath/execPath (Ryan Graham)

  • Update contribution guidelines (Ryan Graham)

2014-08-29, Version 0.1.3

  • Don't fail on --dry-run (Ryan Graham)

2014-07-21, Version 0.1.2

2014-07-21, Version 0.1.1

  • fix: log when/what service is installed (Ryan Graham)

  • fix: skip notice when no directory is created (Ryan Graham)

2014-07-21, Version 0.1.0

  • First release!