Skip to content

Run shell scripts, commands and executables in parallel

License

Notifications You must be signed in to change notification settings

xNaCly/gleichzeitig

Repository files navigation

gleichzeitig

Run shell scripts, commands and executables in parallel (ger: gleichzeitig).

demo.mp4

Install

From release

  1. Download the latest release for your architecture.
  2. Extract the archive
  3. Move the binary to an executable path:
    • Linux:
      $ sudo mv ./gleichzeitig /usr/bin/gleichzeitig
    • Windows:

      copy gleichzeitig to C:\Program Files

From source

requires git and go

  1. clone the repo
$ git clone https://github.com/xnacly/gleichzeitig
$ cd gleichzeitig
  1. build the project
$ go build
  1. move the build executable into the path
$ sudo mv ./gleichzeitig /usr/bin/gleichzeitig
  1. execute to check if everything worked
$ gleichzeitig

Concept

gleichzeitig starts all commands specified in its configuration and keeps them running until they terminate. It redirects all stdout and stderr to its own output and throws errors if a process terminates prematurely or with a non 0 exit code.

Configuration

To keep the gleichzeitig setup low friction, the gleichzeitig init command creates the configuration directory and the config.json file with the default configuration in it.

The configuration is located at .gleichzeitig/config.json in the current working directory and is composed of the following key value pairs:

{
  "only_color_prefix": true,
  "color_output": true,
  "commands": [],
  "log_file": "",
  "surpress_output": false
}
  • only_color_prefix: wheter to color the full stdout and stderr prints or only the prefixes: 0x |
  • color_output: whether the output of the individual commands should be coloured different to allow the user to differentiate between them
  • commands: array of instructions gleichzeitig executes, of the following format:
    {
      "cwd": ".gleichzeitig",
      "cmd": "echo 'test'"
    }
    • cwd: specify the working directory for the command to execute in, supports relative paths
    • cmd: the command to execute, if not found error is thrown
  • log_file: the file to write all logs to
  • surpress_output: whether the commands stdout and stderr should be printed

Usage

command description example
executes the commands in the config gleichzeitig
run,r executes the arguments as commands gleichzeitig run "echo 'hello world'" "ls -la"
init, i creates the config dir, file and writes the default config to it gleichzeitig init
version, v prints the version, exits gleichzeitig version
help, h prints the help, exits gleichzeitig help