10.1.0 • Published 12 months ago

springbokjs-daemon v10.1.0

Weekly downloads
91
License
ISC
Repository
-
Last release
12 months ago

Install

npm install --save-dev springbokjs-daemon

API

All arguments are optional, but you should at least provide command or args.

import createDaemon from 'springbokjs-daemon';

const daemon = createDaemon({
  key: '', // logger key
  displayName: '', // logger displayName
  command: 'node', // default to process.argv[0]
  args: [],
  autorestart: false, // autorestart when the child kills itself
  SIGTERMTimeout: 4000, // time to wait before sending SIGKILL
});

daemon.start(); // returns a Promise on the event ready
daemon.restart(); // do stop() then start()
daemon.stop(); // send SIGTERM then SIGKILL and returns a Promise when the child is killed.

Message

You can send these messages using process.send:

  • ready: to notify that the instance has successfully started
  • restart: ask for a clean restart of the process

Use case with Gulp

var gulp = require('gulp');
var createDaemon = require('springbokjs-daemon');

var daemon = createDaemon({ args: ['src/server/server.js'] });
process.on('exit', function (code) {
  daemon.stop();
});

gulp.task('watch', ['default'], function () {
  daemon.start();
  gulp.watch('src/server/**/*.js').on('change', function () {
    daemon.restart();
  });
});
10.1.0

12 months ago

10.0.0

1 year ago

9.0.0

2 years ago

8.1.0

3 years ago

7.1.0

3 years ago

7.0.0

3 years ago

8.0.0

3 years ago

6.0.0

4 years ago

5.1.3

4 years ago

5.1.2

4 years ago

5.1.1

4 years ago

5.1.0

5 years ago

5.0.0

5 years ago

4.0.0

5 years ago

3.6.0

6 years ago

3.5.0

6 years ago

3.4.0

6 years ago

3.3.1

6 years ago

3.3.0

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.7.1

6 years ago

2.7.0

7 years ago

2.6.0

7 years ago

2.5.0

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago