task-manager
v1.7.0
Published
task-manager for cluster or single application
Downloads
24
Readme
task-manager
Task-manager for cluster or single application, through TCP, TLS, UDP, Unix domain socket.
Use nc
, openssl
, Telnet
or whatever you want as client
Installation
Install through NPM
npm install task-manager
or
git clone git://github.com/hex7c0/task-manager.git
API
for TCP socket
var task = require('task-manager');
task(30000); // tcp port
open client for send commands
$ nc 127.0.0.1 30000
for TLS socket
var task = require('task-manager');
task(30000, {
tls: {
key: ''
}
}); // tls port and cert key
open client for send commands
$ openssl s_client -connect 127.0.0.1:30000
for UDP socket
var task = require('task-manager');
task(30000, {
udp: true
}); // udp port
open client for send commands
$ nc -u 127.0.0.1 30000
for unix domain socket
var task = require('task-manager');
task('s.sock'); // unix domain socket string
open client for send commands
$ nc -U s.sock
commands
show all commands
help
disconnect all children
disconnect
disconnect selected child, with his pid
disconnect 8564
fork a new child
fork
kill all children
kill
kill selected child, with his pid
kill 8564
get father memory
memory
show all pids
ps
get father title
title
set father title
title Ciao
get father uptime
uptime
process exit
exit
close TCP/socket listener
close
task(listen [, options])
listen
listen
- Number | String Number forTCP, TLS, UDP port
, String (path) forUnix Domain socket
(default "required")
[options]
auth
- String Accept commands only ifauth
is correct (default "disabled")output
- Boolean Flag for print info to console (main process) (default "disabled")custom
- String | RegExp Custom validation for client command (after built-in command) (default "disabled")callback
- Function Execute this function, ifcustom
command is accepted (socket and command as arguments) (default "disabled")json
- Boolean Flag for print info in JSON (default "disabled")tls
- Object TLS options (default "disabled")udp
- Boolean Flag for use UDP socket (default "disabled")
Examples
Take a look at my examples