A node process manager that isn't spanners all the way down.
- Monitoring in console
- Configure user/group to run processes as
- Auto process restart on crash
- Log redirection to per process out/err files
- Web interface with support for monitoring multiple hosts
- Cluster support
npm install -g process-boss
Comprehensive help is available on the command line:
and with more detail for each subcommand, e.g.:
bs start --help
The first time you invoke a boss command, the daemon will start in the background. Because boss can run processes as different users, it needs to be able to switch to those users. Consequently you should run boss as root or another privileged user.
Display a list of processes boss has started.
bs start [options] <script>
Start a new process.
-h, --help output usage information -u, --user <user> The user to start a process as -g, --group <group> The group to start a process as -i, --instances <instances> How many instances of the process to start (e.g. cluster mode) -n, --name <name> What name to give the process -a, --argv <argv> A space separated list of arguments to pass to a process -e, --execArgv <execArgv> A space separated list of arguments to pass to the node executable -d, --debug Pause the process at the start of execution and wait for a debugger to be attached -v, --verbose Prints detailed internal logging output
http-server.js as a cluster with two workers, running as
alex:staff and with two command line arguments
-a foo and
$ bs start -u alex -g staff -i 2 -argv '-a foo -b bar' http-server.js
Restart a running process
bs restart <pid>
Stop a running process.
bs stop <pid>
Stop all processes and kill the daemon. By default all currently running processes will be saved and restarted when boss restarts.
After starting a process with
-i $num (e.g. start ``$num` instances of a script), adjust the number of cluster workers.
bs cluster <pid> <workers>
Make process 49308 (previously started with
-i 2) run with 4 workers:
$ bs cluster 49308 4
The maximum workers you can set is dependent on your system as
num_cpus - 1
Send an event to a process
bs send <pid> <event> [args...]
In my script
$ bs send 39823 my:custom:event 1 2 // process 39823 then prints '3' to the logs
Make a process dump a heap snapshot for analysis in Chrome's debug tools.
bs heapdump <pid>
Force a process to do garbage collection
bs gc <pid>
Send a signal to a process (n.b. unless you have a listener for that signal, your process will most likely exit)
bs signal <pid> <signal>
$ bs signal 3984 SIGINT
Show live logs for a process (or all processes if
<pid> is omitted) in the console
bs logs [pid]
processes.json file of running processes to
$CONFIGDIR for use with
Restore running processes from
bs useradd [options] <username> [hostname]
bs rmuser <username>
bs reset <username>
[boss]; The user the daemon will run as - this user should have sufficient; privileges to spawn new processes and then drop their privileges to; that of other usersuser = root; The group the daemon will run as -
See the default config file for more information on the various options.