https://github.com/serapath/lilpids
Dead simple process manager with few features (features cli & programmatic use)
https://github.com/serapath/lilpids
Last synced: 9 months ago
JSON representation
Dead simple process manager with few features (features cli & programmatic use)
- Host: GitHub
- URL: https://github.com/serapath/lilpids
- Owner: serapath
- License: mit
- Created: 2017-01-29T13:58:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-29T20:01:35.000Z (over 9 years ago)
- Last Synced: 2025-10-14T15:13:26.203Z (9 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/lilpids
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lilpids
Dead simple process manager with few features (features cli & programmatic use)
inspiration comes from the [`lil-pids`](https://www.npmjs.com/package/lil-pids) module from [@mafintosh](https://www.npmjs.com/~mafintosh)

# usage
`npm install -g lilpids`
It can either be used as a cli-tool (see [`lil-pids`](https://www.npmjs.com/package/lil-pids))
Otherwise, it also can be used programmatically.
```js
var lilpids = require('lilpids')
var stream$ = lilpids()
stream$.on('error', function (error) {
throw error
})
stream$.on('data', function (pids) {
console.log(pids) // e.g.
/*
[ { pid: '15679', service: 'node test/a.js' },
{ pid: '15685', service: 'node test/b.js' } ]
*/
})
stream$.write([
'node test/a.js',
'node test/b.js'
])
setTimeout(function () {
stream$.write([ 'node test/a.js' ])
}, 15000)
```
It'll watch the stream so every time you pipe an update, old processes no longer referenced in the update will be shutdown and any new ones will be spawned.
lilpids will forward all stdout, stderr to its own stdout, stderr prefixed with the process id.
It will also tell you when a command has been spawned, exited and finally it will restart processes when they crash/end.
lilpids will also push an array of the pids of the current running processes to the stream every time there is a change, so you can listen for them
# license
MIT