0.0.3 • Published 7 years ago

resurrector v0.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

Resurrector

Automatically resurrect processes based on heartbeat signal

It's easy to detect process crash, but hard to detect when it hangs without quitting. Resurrector uses heartbeat through OSC to automatically restart process that stopped responding.

Usage

  1. npm install -g resurrector
  2. write config.json
  3. resurrector config.json

Sample config

{
  "port": 4000,
  "interval": 100,
  "path": "/hb/",
  "processes": [
    { "id": "app 1", "cmd": "node app1.js", "timeout": 2000 },
    { "id": "app 2", "cmd": "node app2.js", "timeout": 5000 }
  ]
}

Main config

  • port - OSC port that resurrector listens on (defaults to 3000)
  • interval - how often resurrector checks for heartbeat (defaults to 100ms)
  • path - OSC path to send heartbeat on (defaults to /hb/)
  • processes - array of processes to start

Process config

  • id - process name, required
  • cmd - command to run
  • timeout - how long to wait before restarting

Heartbeat

Each of the running processes should periodically ping resurrector with OSC message on specified port and path, sending the process id (from config) as only parameter. So for the sample config, process 1 sends: /hb/ "app 1" on OSC 4000, and process 2 sends: /hb/ "app 2" on OSC 4000.