infinite-process-manager
v1.0.4
Published
Manager for long running processes which need to be controlled from NodeJS
Downloads
14
Maintainers
Readme
Infinite Process Manager
Basic Usage
const { InfiniteProcessManager } = require('infinite-process-manager');
const ipmInstance = new InfiniteProcessManager();
export { ipmInstance };
InfiniteProcessManager also accepts options for logging INFO,ERROR and WARN messages.
With custom logger
const ipm = new InfiniteProcessManager({
internalLogger: {
info: (msg) => console.log(msg),
error: (msg) => console.log(msg),
warn: (msg) => console.log(msg),
},
});
The exported instance can then be used to start - stop processes as required.
Starting processes
import { ipmInstance } from '.';
ipmInstance.startInfiniteProcess({
command: 'ls',
processName: 'pName',
commandArgs: ['-lah'],
});
Stopping processes
- To avoid respawn
ipm.stopWithDelete({ processName: 'pName' });
- With respawn
ipm.stopWithAutoRespawn({ processName: 'pName' });