Package detail

strong-service-upstart

strongloop605Artistic-2.01.1.3

Generate an upstart job using the provided parameters.

upstart

readme

strong-service-upstart

Generate an Upstart job using the provided parameters.

Install

npm install strong-service-upstart

Basic Usage

var fs = require('fs');
var upstart = require('strong-service-upstart');

// Generate Upstart job for my-app
upstart({name: 'my-app'}, function(err, job) {
  fs.writeFile('/etc/init/my-app.conf', job, function(err) {
    if (err) console.error(err);
  });
});

// Also supports synchronous mode
fs.writeFileSync('/etc/init/my-app.conf', upstart({name: 'my-app'}));

Options

This module supports a subset of those used in the node-linux templates:

  • name - name of service. In comments in v1.4 and syslog tagging in v0.6. name is an alias for label and servicesummary.
  • description - multi-word description of service. description is an alias for servicedescription.
  • author - sets author field of Upstart job (defaults to current user)
  • cwd - working directory to run service from (defaults to /)
  • user - user to run service as (defaults to nodbody)
  • group - group to run service as (Upstart v1.4 only, defaults to nogroup)
  • execpath - path to binary to executable
  • script - arguments to execpath (such as a script)
  • created - timestamp used in generated job (defaults to current time)
  • env - environment variables to set in Upstart job
  • version - Upstart version to target: 0.6, 1.4(default)
  • template - override internal template

Upstart Versions

Upstart v1.4 added support for setuid and setgid, so the default template requires Upstart v1.4.

A job file compatible with older versions of Upstart can be generated by specifying version: '0.6' in the options (or by providing your own template).

Template Format

Templates use _.template from Lodash using EJS style syntax: <%= option %>.

changelog

2016-05-06, Version 1.1.3

  • update copyright notices and license (Ryan Graham)

2016-04-11, Version 1.1.2

  • Refer to licenses with a link (Sam Roberts)

2015-10-01, Version 1.1.1

  • Use strongloop conventions for licensing (Sam Roberts)

  • test: generate cobertura coverage reports (Ryan Graham)

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

2015-05-28, Version 1.1.0

  • deps: upgrade to lodash@3 (Ryan Graham)

  • test: use official tap (Ryan Graham)

2015-01-12, Version 1.0.2

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

2014-11-14, Version 1.0.1

  • Hide *.tgz from git (and npm pack) (Ryan Graham)

2014-10-16, Version 1.0.0

  • Fix environment variables (Ryan Graham)

  • Update contribution guidelines (Ryan Graham)

2014-07-21, Version 0.1.1

2014-07-20, Version 0.1.0

  • First release!