Sunday, January 29, 2023

[New] sysutils/try_repeat

Please find attached a port for try_repeat 0.2.0
<https://tratt.net/laurie/src/try_repeat/>:

try_repeat tries to run a command n times, exiting early if the command
exits with a non-zero exit code. This is useful when trying to find
intermittent failures in a command.

Examples:

$ try_repeat 3 ls /etc/motd
/etc/motd
/etc/motd
/etc/motd
$ echo $?
0
$ try_repeat 3 ls /doesntexist
ls: /doesntexist: No such file or directory
$ echo $?
1
$ try_repeat -v 3 ls /etc/motd
===> 1: ls /etc/motd
/etc/motd
===> 2: ls /etc/motd
/etc/motd
===> 3: ls /etc/motd
/etc/motd


Laurie

No comments:

Post a Comment