https://github.com/strongloop/strong-service-upstart
Generate an upstart job based on provided parameters
https://github.com/strongloop/strong-service-upstart
Last synced: 9 months ago
JSON representation
Generate an upstart job based on provided parameters
- Host: GitHub
- URL: https://github.com/strongloop/strong-service-upstart
- Owner: strongloop
- License: other
- Created: 2014-07-18T16:32:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-02-05T06:10:53.000Z (almost 7 years ago)
- Last Synced: 2025-04-25T11:05:50.487Z (9 months ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 7
- Watchers: 21
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# strong-service-upstart
Generate an Upstart job using the provided parameters.
## Install
`npm install strong-service-upstart`
## Basic Usage
```js
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](http://lodash.com/docs#template) from Lodash using
EJS style syntax: `<%= option %>`.