https://github.com/strongloop/strong-service-systemd
Generate an systemd service based on provided parameters
https://github.com/strongloop/strong-service-systemd
Last synced: 5 months ago
JSON representation
Generate an systemd service based on provided parameters
- Host: GitHub
- URL: https://github.com/strongloop/strong-service-systemd
- Owner: strongloop
- License: other
- Created: 2014-11-08T00:02:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-02-05T07:50:53.000Z (almost 7 years ago)
- Last Synced: 2025-04-07T01:05:42.381Z (10 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 11
- Watchers: 22
- 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-systemd
Generate an systemd service using the provided parameters.
## Install
`npm install strong-service-systemd`
## Basic Usage
```js
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](http://lodash.com/docs#template) from Lodash using
EJS style syntax: `<%= option %>`.