Crates.io | every |
lib.rs | every |
version | 0.1.0 |
source | src |
created_at | 2024-10-27 23:50:54.820838 |
updated_at | 2024-10-27 23:50:54.820838 |
description | Run a command every N seconds. |
homepage | https://github.com/BenMorel/every |
repository | https://github.com/BenMorel/every |
max_upload_size | |
id | 1425115 |
size | 47,294 |
Run a command every n seconds.
cargo install every
To run echo hello world
every second, use:
every 1s echo hello world
If the command takes longer than the specified interval (1s
in this case), some ticks will be skipped because the concurrency is set to 1
by default.
To allow multiple instances of the command to run in parallel, and reduce skipped ticks, use the -c
option:
every 1s -c 10 curl https://some-slow-api.com/
With this setting, up to 10
commands can run in parallel. The command will execute every second without skipped ticks, as long as the number of parallel executions doesn’t exceed the concurrency limit.
The interval format is a number followed by a unit. The unit can be one of the following:
s
for secondsm
for minutesh
for hoursd
for daysSeconds can have a decimal part: 2.5s
.
Units can be combined: 1h30m
.