| Crates.io | loop-bin |
| lib.rs | loop-bin |
| version | 0.1.3 |
| created_at | 2022-08-09 05:12:43.196075+00 |
| updated_at | 2023-01-20 12:12:02.304799+00 |
| description | Run a command in loop, nothing else. |
| homepage | |
| repository | https://github.com/jcamiel/loop-bin |
| max_upload_size | |
| id | 641563 |
| size | 32,916 |
loopRun 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
$ cargo install loop-bin
$ 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:
$ 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 status=none
$ 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