{"id":19839524,"url":"https://github.com/xeaone/revive","last_synced_at":"2026-05-11T08:53:01.125Z","repository":{"id":65489857,"uuid":"58677116","full_name":"xeaone/revive","owner":"xeaone","description":"Spawn, Monitor, \u0026 Revive System Processes","archived":false,"fork":false,"pushed_at":"2018-03-01T00:08:41.000Z","size":60,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T11:23:09.773Z","etag":null,"topics":["js","monitor","node","nodejs","process","respawn","restarts","revive"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xeaone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-12T21:11:17.000Z","updated_at":"2018-08-14T00:03:07.000Z","dependencies_parsed_at":"2023-01-25T17:35:11.500Z","dependency_job_id":null,"html_url":"https://github.com/xeaone/revive","commit_stats":null,"previous_names":["alexanderelias/revive"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Frevive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Frevive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Frevive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xeaone%2Frevive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xeaone","download_url":"https://codeload.github.com/xeaone/revive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209543,"owners_count":19927735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["js","monitor","node","nodejs","process","respawn","restarts","revive"],"created_at":"2024-11-12T12:22:59.727Z","updated_at":"2026-05-11T08:53:01.059Z","avatar_url":"https://github.com/xeaone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Revive\nA process management tool. Events, status, cluster, and automatic restarts.\n\n## Install\n```\nnpm install revive --save\n```\n\n## Example\n```JavaScript\nconst Revive = require('revive');\n\nconst options = {\n\tname: 'test',\n\n\tcmd: process.execPath,\n\n\targ: ['app.js'],\n\tenv: { PORT: 8000 },\n\tcwd: '/home/user/code/node/app/.',\n\n\tcluster: true,\n\tinstances: 2,\n\n\tstdout: '/logs/stdout.log',\n\tstderr: '/logs/stderr.log',\n\n\tsleepTime: 1000,\n\tcrashTime: 6 * 1000,\n\tmaxCrashCount: 1000\n};\n\nconst monitor = new Revive(options);\n\nmonitor.on('start', function () {\n\tconsole.log(monitor.toJSON());\n});\n\nmonitor.start();\n```\n\n## Options\n- `name: String`                Defaults to `null` the name of the process.\n- `arg: Array, String`          Defaults to `null` arguments or node script.\n- `cwd: String`                 Defaults to `process.cwd()` the current working directory.\n- `cmd: String`                 Defaults to `process.execPath` the systems absolute executable/node path.\n- `cluster: Boolean`            Defaults to `false`.\n- `instances: Number`           Defaults to `os.cpus().length` if cluster is set to `true`\n- `stdout: String`              Defaults to `'pipe'` otherwise a file path. If a path is provided than this event will not fire.\n- `stderr: String`              Defaults to `'pipe'` otherwise a file path. If a path is provided than this event will not fire.\n- `sleepTime: Array, Number`    Defaults to `1000` in milliseconds to sleep between start after a crash.\n- `crashTime: Number`           Defaults to `60000`ms. The time until the `maxCrashCount` resets. So if `1000` crashes happen in `60`s then the process will exit.\n- `maxCrashCount: Number`       Defaults to `1000` crashes. A crash is triggered and the process exited at `nth + 1`.\n- `env: {}`                     Environment variables for the process.\n- `data: {}`                    A custom object for you.\n\n## API\nAll methods execept toJson are async.\n- `monitor.start()` Starts the monitor\n- `monitor.stop()` Stops the monitor (kills the process if its running with `SIGKILL`).\n- `monitor.restart()` Restarts the monitor by stopping then starting (process must be started).\n- `monitor.toJSON()` Creates a stringyifiable object. The object returns stats and data about the process.\n\n## Cluster Events\n- `monitor.on('status', callback)`\n- `monitor.on('start', callback)` Starts the process. Warning async so process may not be available immediately.\n- `monitor.on('stop', callback)`  The process and it's tree is sent a `SIGTERM` signal. If the process does not terminate after ten seconds then the process is sent a `SIGKILL` signal.\n- `monitor.on('restart', callback)` Same as stopping then starting or vice versa.\n- `monitor.on('stdout', callback)` Emits an stdout. Only available if no `Options.stdout` is `pipe`.\n\t- `Stdout` Parameter the stdout message.\n- `monitor.on('stderr', callback)` Emits an stderr. Only available if no `Options.stderr` is `pipe`.\n\t- `Stderr` Parameter the stderr message.\n- `monitor.on('error', callback)` Emits when the process could not spawn, kill, or a message failed.\n\t- `Error` Parameter the error message.\n- `monitor.on('exit', callback)` The process has exited.\n\t- `Code` The numeric exit code\n\t- `Signal` The string signal\n\n## Instance Events\n- `monitor.on('reload', callback)` Zero downtime restart if `cluster` is set to `true` and `instances` is greater than one.\n- `monitor.on('sleep', callback)` Triggered when process crashes and enters sleep.\n- `monitor.on('crash', callback)` Triggered when the process crashes.\n\n## Issues\nImmediate `start` then `stop` execution does not send the signals. This could be a problem with node.js.\n\n## Authors\n[AlexanderElias](https://github.com/AlexanderElias)\n\n## License\n[Why You Should Choose MPL-2.0](http://veldstra.org/2016/12/09/you-should-choose-mpl2-for-your-opensource-project.html)\nThis project is licensed under the MPL-2.0 License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeaone%2Frevive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxeaone%2Frevive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxeaone%2Frevive/lists"}