Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
try-hard(1)		     General Commands Manual		     try-hard(1)

NAME
     try-hard -- retries a command multiple times in case of failure

SYNOPSIS
     try-hard max_trials max_delay
	      [-m min_delay | --min-delay min_delay]
	      [-A delay_increment | --additive-increase delay_increment]
	      [-M delay_factor | --multiplicative-increase delay_factor]
	      [-T max_delay | --truncate-delay truncated_max_delay]
	      [-D | --deterministic]
	      [-q | --quiet] [-w | --verbose]
	      -- command ...
     try-hard [-h | --help]
     try-hard [-v | --version]

DESCRIPTION
     try-hard  tries to run a command up to a given number of trials max_trials.
     In case of failure, the program waits for a specific delay before the  next
     trial.   The  delay  to  wait  is	by  default  randomly chosen (using ran-
     dom-sleep) from the interval [min_delay, max_delay].  Alternatively, in de-
     terministic mode, the delay is always max_delay.  For each new trial, it is
     possible to increase the interval [min_delay, max_delay] by  a  multiplica-
     tive-increase  factor  as well as an additive-increase increment. The upper
     bound for max_delay can be limited by truncated_max_delay to  prevent  fur-
     ther  increases. The initial min_delay is always the lower bound.	On fail-
     ure, the exit code of the last failed trial is returned.

ARGUMENTS
     The following options are available:

     max_trials
	     The maximum number of trials.

     max_delay
	     The maximum delay.

     -m min_delay | --min-delay min_delay
	     Sets the minimum delay min_delay (default: 0.0).

     -A delay_increment | --additive-increase delay_increment
	     Sets the additive-increase delay increment (default: 0.0).

     -M delay_factor | --multiplicative-increase delay_factor
	     Sets the multiplicative-increase delay factor (default: 1.0).

     -T max_delay | --truncate-delay truncated_max_delay
	     Sets the truncated_max_delay for limiting the increase of max_delay
	     (default: 31536000.0, i.e. 1 year).

     -D | --deterministic
	     Sets deterministic mode, i.e. turns off randomisation of the delay.

     -q | --quiet
	     Quiet mode: no output is made.

     -w | --verbose
	     Verbose mode: print selected delay and wake-up.

     -h | --help
	     Prints the program's command-line parameters and exits.

     -v | --version
	     Prints the program version and exits.

EXIT STATUS
     The try-hard tool exits with 0 on success. On failure, the exit code of the
     last failed trial is returned.

EXAMPLES
     try-hard	    10	     60       --verbose       --	git	   clone
	     https://dreibh@github.com/dreibh/rserpooldemo.git

     try-hard 3 300 -q -- git clone https://git.freebsd.org/ports.git

     try-hard	    3	    65.5       --	wget	  -O	  example.tar.gz
	     https://www.example.net/example.tar.gz

     try-hard 10 1.0 -w -- false

     try-hard	10   2.0   --min-delay	 1.0	--multiplicative-increase    2.0
	     --truncate-delay 3600.0 -w -- false

     try-hard 10 1.0 -m 1 -M 2 -T 3600 -w -- false

     try-hard 10 1 --min-delay 0.5 --additive-increase 5 --truncate-delay 300 -w
	     -- false

     try-hard 10 1 -m 1 -A 5 -T 300 -w -- false

     try-hard 10 1.0 --deterministic -w -- false

     try-hard 10 1.0 -D -w -- false

     try-hard --version

     try-hard --help

SEE ALSO
     random-sleep(1)

NOTES
     This  program  is	part of System-Tools. The latest version of System-Tools
     can be found on the System-Tools Homepage at System-Tools Homepage.

AUTHORS
     Thomas Dreibholz, Homepage

try-hard			   May 9, 2026			     try-hard(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=try-hard&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help