Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baalimago/repeater
A tool which repeats a command n amounts of time. Includes parallelization, error handling, progress and slight tweaks.
https://github.com/baalimago/repeater
go parallel productivity repeater shell
Last synced: 3 days ago
JSON representation
A tool which repeats a command n amounts of time. Includes parallelization, error handling, progress and slight tweaks.
- Host: GitHub
- URL: https://github.com/baalimago/repeater
- Owner: baalimago
- License: mit
- Created: 2023-10-01T13:54:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-09T16:30:54.000Z (5 months ago)
- Last Synced: 2024-09-09T20:29:32.748Z (5 months ago)
- Topics: go, parallel, productivity, repeater, shell
- Language: Go
- Homepage:
- Size: 215 KB
- Stars: 59
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# repeater
A tool which repeats a command n amounts of time, with paralellisation and slight tweaks.Test coverage: 58.440% 😌👏
![repeatoopher](./img/repeatoopher.jpg)
### Installation
```bash
go install github.com/baalimago/repeater@latest
```You may also use the setup script:
```bash
curl -fsSL https://raw.githubusercontent.com/baalimago/repeater/main/setup.sh | sh
```## Usage
Since v1.2.1, repeater will re-attempt the command until successful.
A success is a command returning exit code 0.
Set flag `-retryOnFail=false` if you simply wish to repeat the CMD `-n` amount of times, regardless of outcome.Usecases:
* CRUD state using curl as fast as you have network sockets
* Paralellize repetitive shell-scripts
* Ghetto benchmarking```bash
repeater \
-n 100 `# repeat 100 times` \
-w 10 ` # using 10 workers` \
-output FILE ` # with command output written to FILE` \
-progress BOTH ` # with progress written to BOTH STDOUT and FILE` \
-file ./run_output ` # with FILE ./run_output` \
-result ./run_result ` # with result (output + time taken) for each command` \
curl example.com ` # command to repeat`
``````bash
# This will print "this is increment: 1\nthis is increment: 2\n..."
repeater -n 100 -output STDOUT -progress HIDDEN -increment echo "this is increment: INC"# Show all available flags
repeater -h
```## Benchmarks
`repeater` outperforms many other parallizers, including GNU parallel and xargs.Run `./benchmark.sh` to try out repeaters performance vs similar parallelization tools.
You may benchmark any command that you want, simply run `./benchmark.sh `.
It will run the command with `repeater`, `parallel` and `xargs` and print the time taken for each by starting to repeat the command 10 times then 100, 1000, etc up until ``.
Note that `./benchmark.sh` will break if it detects and diffs in the output of the commands, so ensure the commands output is deterministic.