0.0.3 • Published 7 years ago
resurrector v0.0.3
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
npm install -g resurrector
- write
config.json
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 to3000
)interval
- how often resurrector checks for heartbeat (defaults to100
ms)path
- OSC path to send heartbeat on (defaults to/hb/
)processes
- array of processes to start
Process config
id
- process name, requiredcmd
- command to runtimeout
- 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
.