Détail du package

strong-service-systemd

strongloop599Artistic-2.01.2.3

Generate an systemd job using the provided parameters.

systemd

readme

strong-service-systemd

Generate an systemd service using the provided parameters.

Install

npm install strong-service-systemd

Basic Usage

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

// Generate systemd service for my-app
systemd({name: 'my-app'}, function(err, service) {
  fs.writeFile('/etc/systemd/system/my-app.service', service, function(err) {
    if (err) return console.error(err);
  });
});

// Also supports synchronous mode
fs.writeFileSync('/etc/systemd/system/my-app.service', systemd({name: 'my-app'}));

Options

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

  • name - name of service. 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 systemd 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 (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 systemd job
  • template - override internal template

Template Format

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

changelog

2016-05-06, Version 1.2.3

  • update copyright notices and license (Ryan Graham)

2016-04-11, Version 1.2.2

  • Refer to licenses with a link (Sam Roberts)

2015-10-01, Version 1.2.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.2.0

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

2015-03-12, Version 1.1.0

  • Remove After/Wants options and allow service to be enabled/disabled. (braincomb)

  • test: use official tap (Ryan Graham)

2015-01-12, Version 1.0.1

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

2014-11-07, Version 1.0.0

  • First release!