项目作者: reddec

项目描述 :
Run and control multiple executables
高级语言: JavaScript
项目地址: git://github.com/reddec/runbatch.git
创建时间: 2018-04-22T14:06:38Z
项目社区:https://github.com/reddec/runbatch

开源协议:MIT License

下载


Runbatch

Simple utility for run multiple instances of one application with template environment and command line.

Very useful for testing purpose.

Template engine - templayed.js

Install

  1. npm install -g runbatch

Usage

Example 1 (template)

you need to start multiple TCP listeners from 9000 to 9099

  1. runbatch -c 100 -- nc -l '{{index + 9000}}'

Example 2 (stuck process)

some process will not close after SIGINT close: specify maximum graceful timeout in ms by -t, --timeout <ms>

  1. runbatch -t 10000 -- app
  2. # wait for 10 seconds after SIGTERM and then send SIGKILL (terminate)

Example 3 (fail fast)

if you need stop every processes after first fail (non-zero code) you can use -f, --fail-fast flag

  1. runbatch -f -- nc -l '{{index + 9000}}'
  2. # if at least one nc not bind then every one are closed

Example 4 (dynamic environment)

you can set template environment variable by flag -e, --env [key=value]

  1. runbatch -e "NODE_ID={{index}}" -- app