<commit_before># z1

[![Build Status](https://circleci.com/gh/robojones/z1.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/robojones/z1/tree/master)
[![Test Coverage](https://codeclimate.com/github/robojones/z1/badges/coverage.svg)](https://codeclimate.com/github/robojones/z1/coverage)

[![bitHound Code](https://www.bithound.io/github/robojones/z1/badges/code.svg)](https://www.bithound.io/github/robojones/z1)
[![bitHound Overall Score](https://www.bithound.io/github/robojones/z1/badges/score.svg)](https://www.bithound.io/github/robojones/z1)
[![bitHound Dependencies](https://www.bithound.io/github/robojones/z1/badges/dependencies.svg)](https://www.bithound.io/github/robojones/z1/master/dependencies/npm)
[![bitHound Dev Dependencies](https://www.bithound.io/github/robojones/z1/badges/devDependencies.svg)](https://www.bithound.io/github/robojones/z1/master/dependencies/npm)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

__z1__ is a Node.js cluster management program. It works on Linux Debian, Ubuntu, and other Debian based distributions.

When using Node.js on a __web server__, one will somehow come to the point where he wants to start __multiple processes__ for one app.
The main goal of z1 is to __simplify__ the creation and management of clusters.

## Table of contents

- [Features](#features)
- [Setup](#setup)
  - [Installation](#installation)
  - [Automatically resurrect z1](#automatically-resurrect-z1)
  - [Prepare package.json](#prepare-packagejson)
  - [Development](#development)
- [CLI](#cli)
  - [Environment variables](#environment-variables)
  - [Start](#start)
  - [Restart](#restart)
  - [List](#list)
  - [Info](#info)
  - [Stop](#stop)
  - [Exit](#exit)
  - [Resurrect](#resurrect)
  - [Install and Uninstall](#install-and-uninstall)
  - [Passing arguments to workers](#passing-arguments-to-workers)
- [API](#api)
  - [z1.start](#z1startdir-args-opt-env-immediate)
  - [z1.restart](#z1restartapp-opt-immediate)
  - [z1.stop](#z1stopapp-opt-immediate)
  - [z1.info](#z1infoapp)
  - [z1.list](#z1list)
  - [z1.exit](#z1exit)
  - [z1.resurrect](#z1resurrectimmediate)
  - [z1.ready](#z1ready)

## Features

The focus of z1 is on simplicity.
Therefore it uses the __existing package.json__ of your project and allows you to start your app by typing `z1 start` in the project folder.
z1 also comes with a __graceful restart__ functionality which allows you to restart your cluster without rejecting any request.

## Setup

### Installation

Via [NPM](https://npmjs.com)

```
sudo npm install z1 -g
```

__Note:__
You might want to run `z1 resurrect` automatically after rebooting your system.
It will start the z1 daemon and all the apps that were running before.
(see: [install command](#install-and-uninstall))

### Prepare package.json

Before you can cluster your Node.js app,
you need to add a few things to your
`package.json` file.

1. __name__ - your app name
2. __main__ - the entry point of your app
3. __ports__ - _(optional)_an array of port numbers that your app uses
4. __workers__ _(optional)_ - a number specifying how many workers should be created for your app. The default value is the number of CPU-cores in your system.<commit_msg>fix readme<commit_after># z1

[![Build Status](https://circleci.com/gh/robojones/z1.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/robojones/z1/tree/master)
[![Test Coverage](https://codeclimate.com/github/robojones/z1/badges/coverage.svg)](https://codeclimate.com/github/robojones/z1/coverage)

[![bitHound Code](https://www.bithound.io/github/robojones/z1/badges/code.svg)](https://www.bithound.io/github/robojones/z1)
[![bitHound Overall Score](https://www.bithound.io/github/robojones/z1/badges/score.svg)](https://www.bithound.io/github/robojones/z1)
[![bitHound Dependencies](https://www.bithound.io/github/robojones/z1/badges/dependencies.svg)](https://www.bithound.io/github/robojones/z1/master/dependencies/npm)
[![bitHound Dev Dependencies](https://www.bithound.io/github/robojones/z1/badges/devDependencies.svg)](https://www.bithound.io/github/robojones/z1/master/dependencies/npm)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

__z1__ is a Node.js cluster management program. It works on Linux Debian, Ubuntu, and other Debian based distributions.

When using Node.js on a __web server__, one will somehow come to the point where he wants to start __multiple processes__ for one app.
The main goal of z1 is to __simplify__ the creation and management of clusters.

## Table of contents

- [Features](#features)
- [Setup](#setup)
  - [Installation](#installation)
  - [Automatically resurrect z1](#automatically-resurrect-z1)
  - [Prepare package.json](#prepare-packagejson)
  - [Development](#development)
- [CLI](#cli)
  - [Environment variables](#environment-variables)
  - [Start](#start)
  - [Restart](#restart)
  - [List](#list)
  - [Info](#info)
  - [Stop](#stop)
  - [Exit](#exit)
  - [Resurrect](#resurrect)
  - [Install and Uninstall](#install-and-uninstall)
  - [Passing arguments to workers](#passing-arguments-to-workers)
- [API](#api)
  - [z1.start](#z1startdir-args-opt-env-immediate)
  - [z1.restart](#z1restartapp-opt-immediate)
  - [z1.stop](#z1stopapp-opt-immediate)
  - [z1.info](#z1infoapp)
  - [z1.list](#z1list)
  - [z1.exit](#z1exit)
  - [z1.resurrect](#z1resurrectimmediate)
  - [z1.ready](#z1ready)

## Features

The focus of z1 is on simplicity.
Therefore it uses the __existing package.json__ of your project and allows you to start your app by typing `z1 start` in the project folder.
z1 also comes with a __graceful restart__ functionality which allows you to restart your cluster without rejecting any request.

## Setup

### Installation

Via [NPM](https://npmjs.com)

```
sudo npm install z1 -g
```

__Note:__
You might want to run `z1 resurrect` automatically after rebooting your system.
It will start the z1 daemon and all the apps that were running before.
(see: [install command](#install-and-uninstall))

### Prepare package.json

Before you can cluster your Node.js app,
you need to add a few things to your
`package.json` file.

1. __name__ - your app name
2. __main__ - the entry point of your app
3. __ports__ _(optional)_ - an array of port numbers that your app uses
4. __workers__ _(optional)_ - a number specifying how many workers should be created for your app. The default value is the number of CPU-cores in your system.
{'fraction_non_alphanumeric': 0.14351285189718482, 'fraction_numerical': 0.013157894736842105, 'mean_word_length': 4.679409209383145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 30, 'lorem ipsum': 0, 'www.': 16, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5023514', 'n_tokens_mistral': 2338, 'n_tokens_neox': 2205, 'n_words': 545}