loopner (short alias lpn) is a command-line utility to run any command multiple times with delays, error handling, and nice statistics. Perfect for load testing, monitoring, repetitive tasks, and learning.
- π Repeat a command a specified number of times
- β±οΈ Delay between runs (supports fractional seconds, e.g.,
0.5) - π¦ Choose error behavior: stop or continue (
-k) - π€« Quiet mode (
-q) β only the command's own output - π£οΈ Verbose mode (
-v) β show per-run timing and status - π Final summary: successful/failed runs, total time
- π§© Supports any command and arguments (including passing options via
--) - π©Ί Checks command existence before first run
- π Graceful handling of Ctrl+C and SIGTERM
- π Two names in the system:
loopnerand shortlpn
loopner [OPTIONS] [--] [args...]
(you can use lpn instead of loopner)
| Option | Long version | Description |
|---|---|---|
-n N |
--count N |
Number of repetitions (default 1) |
-d SEC |
--delay SEC |
Delay between runs in seconds (default 0) |
-k |
--keep-going |
Continue on error (otherwise stop) |
-q |
--quiet |
Only command output, no helper messages |
-v |
--verbose |
Detailed output (timing, status) |
-h |
--help |
Show help |
-- |
β | Separator: everything after is the command |
# Run ls -la 5 times
loopner -n 5 ls -la
# Using short name lpn, 3 pings with 1 second delay
lpn -n 3 -d 1 -- ping -c 1 google.com
# Continue even on errors (2 runs, will exit with code 2)
lpn -k -n 2 false
# Quiet mode β only command output
loopner -q -n 100 -- curl -s https://api.ipify.org
# Verbose mode with execution time
loopner -v -n 4 -- sleep 0.5| Code | Meaning |
|---|---|
| 0 | All runs succeeded |
| 1β¦254 | Number of failed runs (if -k is used) |
| 127 | Command not found |
| 130 | Interrupted by user (Ctrl+C) |
| 143 | Terminated by SIGTERM |
- bash 4.0 or higher
- bc (floating-point calculations) β usually preinstalled
- getopt (enhanced version, part of util-linux)
Check availability:
which getopt bcgit clone https://github.com/nesgen/loopner.git
cd loopner
chmod +x install.sh
sudo ./install.shgit clone https://github.com/nesgen/loopner.git
cd loopner
sudo make installsudo curl -L https://raw.githubusercontent.com/nesgen/loopner/main/loopner -o /usr/local/bin/loopner && \
sudo chmod +x /usr/local/bin/loopner && \
sudo ln -s /usr/local/bin/loopner /usr/local/bin/lpnsudo make uninstall # if installed via Makefile
# or manually:
sudo rm /usr/local/bin/loopner /usr/local/bin/lpnIssues and pull requests are welcome! Please open an issue first to discuss any major changes.