Run a command in loop.

Overview

♾️ loop

Run a command in loop, nothing else.

USAGE:
    loop [OPTIONS] <CMD>...

ARGS:
    <CMD>...    Command to execute

OPTIONS:
    -d, --delay <delay>    Delay between iteration in milliseconds
    -h, --help             Print help information
    -i, --iter <iter>      Number of iteration
        --no-stat          Do not display statistics at the end of execution
        --while-ko         Loop while exit code is failure
        --while-ok         Loop while exit code is success

Installation

$ cargo install loop-bin

Samples

$ loop --iter 4 --delay 1000 date
Tue Aug  9 06:59:58 CEST 2022
Tue Aug  9 06:59:59 CEST 2022
Tue Aug  9 07:00:00 CEST 2022
Tue Aug  9 07:00:01 CEST 2022

date total: 4 ok: 4 ko: 0

At the end of execution (or if ctrl+c interrupts the loop), a summary of the number of success and failure is outputted. This summary can be deactivated with --no-stat option.

loop can easily be used with time:

  • Generate random_time:
    $ dd if=/dev/urandom of=/dev/null bs=1 count=1024 status=none
  • Loop for 1000 iteration generating random data:
    $ loop --iter 1000 --no-stat dd if=/dev/urandom of=/dev/null bs=1 count=1024 status=none
  • How much time is needed:
    $ time loop --iter 1000 --no-stat dd if=/dev/urandom of=/dev/null bs=1 count=1024 status=none
    loop --iter 1000 --no-stat dd if=/dev/urandom of=/dev/null bs=1 count=1024   0.60s user 1.05s system 95% cpu 1.723 total

Another example with hurl to perform tests on HTTP endpoints:

$ loop --while-ok hurl test.hurl
...
hurl total: 140 ok: 139 ko: 1
You might also like...
A toy example showing how to run Rust code in Python for speed and progress.

PoC: Integrating Rust in Python A toy example showing how to run Rust code in Python for speed and progress. Requirements Python 3.6+ Rust 1.44+ Cargo

A simple, modern fuzzy finder tool to run examples in a Cargo project.

cargo-rx cargo-rx is a simple, modern Runner for Examples in a Cargo project. This crate provides a single executable: rx. Basically anywhere you woul

CLI application to run clang-format on a set of files specified using globs in a JSON configuration file.
CLI application to run clang-format on a set of files specified using globs in a JSON configuration file.

run_clang_format CLI application for running clang-format for an existing .clang-format file on a set of files, specified using globs in a .json confi

Run code from many programming languages!

Langbot Creating an image Install podman Build an image: podman build -t langbot . Running a language Run podman run --rm -i langbot ./scripts/run.sh

A run-codes cli front end with some extra features

run-cli Run-cli A run-codes cli front end with some extra features Report Bug · Request Feature Table of Contents About The Project Built With Getting

CLI application to run clang-tidy on a set of files specified using globs in a JSON configuration file.
CLI application to run clang-tidy on a set of files specified using globs in a JSON configuration file.

run-clang-tidy CLI application for running clang-tidy for an existing .clang-tidy file on a set of files, specified using globs in a .json configurati

Example to run Rust code on the MCH2022 badge.
Example to run Rust code on the MCH2022 badge.

Rust on the MCH2022 badge This repo contains instructions and code to run Rust on the MCH2022 badge. There are two approaches regarding environment: I

Cargo subcommand to easily run targets/examples

cargo-select Cargo subcommand to easily run targets/examples/tests Fuzzy match against targets, examples or tests in current rust project. cargo-selec

Run adb in Termux without root permissions!

termux-adb Run adb in Termux without root permissions! Description This is a launcher for adb which enables debugging of one Android device from anoth

Owner
null
🕺 Run React code snippets/components from your command-line without config

Run React code snippets/components from your command-line without config.

Eliaz Bobadilla 11 Dec 30, 2022
CarLI is a framework for creating single-command and multi-command CLI applications in Rust

CarLI is a framework for creating single-command and multi-command CLI applications in Rust. The framework provides error and IO types better suited for the command line environment, especially in cases where unit testing is needed.

Kevin Herrera 3 Jan 21, 2022
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

Quentin Texier (g0h4n) 104 Oct 7, 2023
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
🤖 just is a handy way to save and run project-specific commands.

just just is a handy way to save and run project-specific commands. (非官方中文文档,这里,快看过来!) Commands, called recipes, are stored in a file called justfile

Casey Rodarmor 8.2k Jan 5, 2023
Run your Rust CLI programs as state machines with persistence and recovery abilities

step-machine Run your CLI programs as state machines with persistence and recovery abilities. When such a program breaks you'll have opportunity to ch

Imbolc 31 Nov 23, 2022
1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel

massh 1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel. The binary crates are CLI and GUI "frontends" for the li

null 2 Oct 16, 2022
koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

null 3 Nov 27, 2021
Helps cargo build and run apps for iOS

cargo-xcodebuild Helps cargo build and run apps for iOS. ?? ⚙️ ?? Setup You need to install Xcode (NOT just Command Line Tools!), xcodegen, cargo-xcod

Igor Shaposhnik 29 Nov 22, 2022