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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    2
    • latest

Version History

Package Sidebar

Install

npm i rebirth

Weekly Downloads

2

Version

2.0.0

License

BSD-2-Clause

Unpacked Size

3.5 kB

Total Files

4

Last publish

Collaborators

  • silverwind