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

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i rebirth

    Weekly Downloads

    1

    Version

    2.0.0

    License

    BSD-2-Clause

    Unpacked Size

    3.5 kB

    Total Files

    4

    Last publish

    Collaborators

    • silverwind