Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

rebirth

2.0.0 • Public • Published

rebirth

Restart a node process from within itself

Restarting is done by spawning a detached copy of the current process and subsequently ending the running process. The new child will be orphaned and parented to PID 1 (init/systemd/launchd).

Installation

$ npm install --save rebirth

Example

const rebirth = require('rebirth');
 
rebirth();
// process restarts

Notes:

  • To detect if a process was reborn, check if process.env.REBORN is '1';
  • Standard streams will be inherited by default. When running in a terminal, this means stdout/stderr will still print to that terminal after a restart. If you don't care about these streams, set opts.stdio = 'ignore'.

API

rebirth([options])

© silverwind, distributed under BSD licence

install

npm i rebirth

Downloadsweekly downloads

14

version

2.0.0

license

BSD-2-Clause

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability