parax
v1.5.0
Published
> parallel exec
Readme
parax
parallel exec
parax runs multiple commands in parallel from a JSON descriptor file. It supports restarting crashed processes, delayed starts, and a built-in web server that tracks restart counts.
Installation
npm install --global paraxUsage
parax commands.jsonDescriptor fields
commands (required)
Array of command objects to run in parallel.
| Field | Type | Description |
| ------- | -------- | ------------------------------------ |
| cmd | string | The executable to run |
| args | string[] | Arguments to pass to the executable |
| cwd | string | Working directory for the process |
| env | object | Extra environment variables |
| delay | number | Milliseconds to wait before starting |
keepAlive
When true, any process that exits is automatically restarted.
loopMillis
How often (in milliseconds) parax checks process state. Defaults to 2000.
webPort
When set, starts an HTTP server on the given port exposing restart counts at GET /restarts.
Examples
Basic parallel execution:
{
"commands": [
{ "cmd": "npm", "args": ["run", "dev"], "cwd": "./frontend" },
{ "cmd": "npm", "args": ["run", "start"], "cwd": "./backend" }
]
}Keep services alive with a delayed start:
{
"keepAlive": true,
"commands": [
{ "cmd": "node", "args": ["db.js"] },
{ "cmd": "node", "args": ["server.js"], "delay": 2000 }
]
}Track restarts via the web server:
{
"keepAlive": true,
"webPort": 3000,
"commands": [
{ "cmd": "node", "args": ["worker.js"] },
{ "cmd": "node", "args": ["api.js"] }
]
}GET http://localhost:3000/restarts
[
{ "cmd": "node worker.js", "restarts": 2 },
{ "cmd": "node api.js", "restarts": 0 }
]