FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stackrox/operator/hack/retry.sh at master · stackrox/stackrox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stackrox
/
stackrox
Public
Notifications
You must be signed in to change notification settings
Fork
191
Star
1.3k
Code
Issues
54
Pull requests
602
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
stackrox
/
operator
/
hack
/
retry.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
33 lines (25 loc) · 825 Bytes
Breadcrumbs
stackrox
/
operator
/
hack
/
retry.sh
Copy path
File metadata and controls
executable file
·
33 lines (25 loc) · 825 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!
/bin/bash
set
-eu -o pipefail
#
shellcheck source=../hack/common.sh
source
"
$(
dirname
"
$0
"
)
/../hack/common.sh
"
die
() {
log
"
$@
"
exit
1
}
function
main()
{
if
[
$#
-lt
2 ]
;
then
die
"
Usage:
$0
<number of attempts> <delay between attempts in seconds> <command> [ <command arg> ... ]
"
fi
local
-r n_attempts=
"
${1
:-
}
"
;
shift
if
!
[
"
$n_attempts
"
-gt
0 ]
2>
/dev/null
;
then
die
"
Error: '
$n_attempts
' is not a valid number of attempts, please provide a positive natural number.
"
fi
local
-r delay=
"
${1
:-
}
"
;
shift
if
!
{ [
"
$delay
"
-gt
0 ]
2>
/dev/null
||
[
"
$delay
"
-eq
0 ]
2>
/dev/null
;
}
;
then
die
"
Error: '
$delay
' is not a number of seconds.
"
fi
log
"
** Executing '
$*
' with
$n_attempts
attempts **
"
log
retry
"
$n_attempts
"
"
$delay
"
"
$@
"
}
main
"
$@
"
Back
|
FazBrowse Home
|
New Git URL