Skip to content

nesgen/loopner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

loopner – optimize your routine

Bash License: MIT Version

Russian English

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.

✨ Features

  • πŸ” 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: loopner and short lpn

πŸš€ Usage

loopner [OPTIONS] [--] [args...]

(you can use lpn instead of loopner)

Options

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

πŸ“ Examples

# 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

πŸ“Š Exit codes

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

πŸ› οΈ Requirements

  • bash 4.0 or higher
  • bc (floating-point calculations) – usually preinstalled
  • getopt (enhanced version, part of util-linux)

Check availability:

which getopt bc

πŸ“¦ Installation

Method 1 – install.sh (recommended)

git clone https://github.com/nesgen/loopner.git
cd loopner
chmod +x install.sh
sudo ./install.sh

Method 2 – Makefile

git clone https://github.com/nesgen/loopner.git
cd loopner
sudo make install

Method 3 – curl

sudo 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/lpn

Uninstallation

sudo make uninstall   # if installed via Makefile

# or manually:
sudo rm /usr/local/bin/loopner /usr/local/bin/lpn

🀝 Contributing

Issues and pull requests are welcome! Please open an issue first to discuss any major changes.

About

πŸ” loopner (lpn) – command-line utility to repeat any command N times with configurable delay, continue-on-error, quiet/verbose modes, execution time measurement, and final statistics. Perfect for load testing, API polling, and automation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors